2018-09-26 04:47:32

Hi all,

For those of you who host the website on the vps, how do you get your domain to points to different directory of your website on the server side? For example, if you host a Wordpress site on your VPS, if you want to go to the admin login area, you would type: "yourdomain.com/wp-admin," or "yourdomain.com/wp-login.php." But in my case, I have a Freenom domain, and I'm not using the URL forwarding, I set an A record to point to my IP address instead. so, I have mywebsite.com instead of typing the longish IP address to get to my website. When I'm on the main page, the address bar still shows my domain name, being mydomain.com, of course. But when I click like link login from the main page, the browser's address bar showing my IP again.

So, the question is, how do I prevent people from seeing my IP address to always show my domain.com followed by a / when I go to different page on my website?

Thanks.

2018-09-26 07:46:53 (edited by Hijacker 2018-09-26 07:47:47)

Hi,

well, this isn't the fault of your domain. Take wordpress for example.
Wordpress asks you for your domain name when installing it. Thats because it requires this information to create the links on your wordpress page correctly. If you installed it using your ip address instead of your domain, it probably saved your ip address as valid domain instead of your actual domain and each time you access the wordpress page, the links will be created by using your ip address instead of the domain.
You can change this inside wordpress admin panel as far as I know.
If it comes to most other websites, if you created absolute links within your web page, they most probably consist of your ip address as well. You just need to rewrite them to use your domain name instead.
A more reliable way would be to use relative addresses instead. Like, instead of writing a link like https://yourdomain.com/wp-admin/ into your source code, just try /wp-admin/ and the browser will auto complete to an absolute address by filling in the address you used to access the page. Thats more reliable, because when you access the page using yourdomain.com, the link will point to yourdomain.com/wp-admin/ as well, but if you experiment with something and use 127.0.0.1 or localhost instead, the link will point to localhost/wp-admin/ instead.
Best Regards.
Hijacker

2018-09-26 10:58:00

Thanks for your reply.

2018-09-27 12:03:11

and you can not really hide your ip to far, because if a user simply pings your website, the will any ways get the ip address

best regards
never give up on what ever you are doing.

2018-09-27 15:11:50 (edited by Socheat 2018-09-27 15:12:49)

@4 I don't want to hide from the ping, I want to hide from the address bar and that's it.

2018-09-27 17:16:04

You must create virtual hosts in your apache directory. If you need I can provide further instructions.

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2018-09-28 04:51:16

@6, sure thing. Would be cool to know that.

2018-10-06 20:58:27

OK, sorry for the ultra big delay and stuff, I just have no motivation to exist online.
Now to the guide.
You are running apache, right? Your FQDN (Fully Qualified Domain name) is configured, right?
If both statements are true then do the following.
1. Create your directories.
The first think to do is to create your new user and the directory structure.
It would work like that
adduser nuno
cd /home/nuno
mkdir -p public_html
mkdir -p logs
2. Write your virtual host file.
Go to the following folder /etc/apache2/sites-available
and create an empty file called for instance "example.conf"
Then paste this into the file, replacing my statements with your own ones
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName radio-fundacja.pl
ServerAlias www.radio-fundacja.pl
DocumentRoot /home/radio/public_html
ErrorLog /home/radio/logs/error.log
CustomLog /home/radio/logs/access.log combined
</virtualHost>
3. Activate your site.
OK, if you've properly created and saved the file then do the following
a2ensite yoursitename
systemctl restart apache2
You're done!
Hope I helped,
N

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2018-10-07 11:10:47

Thanks for your instructions