Question

I have created virtual host for my domain,when i enter it & it opens and if i click on any link it goes to next page but shows ip path.

Posted February 22, 2019 299 views
UbuntuApache

www.swapnilrsl.tk my domain i want it redirect to http://IP_Address/basket/Newbasket/
<VirtualHost *:80>
ServerName www.swapnilrsl.tk
ServerAlias www.swapnilrsl.tk
DocumentRoot /var/www/html/basket/Newbasket/
<Directory /var/www/html/basket/Newbasket/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHELOGDIR}/error.log
CustomLog ${APACHELOGDIR}/access.log combined

 RewriteEngine on
 RewriteCond %{HTTP_HOST} ^www.swapnilrsl.tk
 RewriteRule ^(.*) http://IPAddress/basket/Newbasket/$1 [P]
</VirtualHost>

it goes to correct path after entering it in browser with domain in address bar www.swapnilrsl.tk but when i click on any link of that page it goes to that link but shows IP address and directory path of that page.
i want it show only www.swapnilrsl.tk/directory.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

Your config looks correct. I would just recommend changing the ServerName to your non-www domain as you’ve already added your www version to your ServerAlias List.

Beside that, your problem is most likely on application level. For example if you are using Wordpress you need to make sure that your Site and Home URLs are set correctly to your domain and not your IP address.

Regards,
Bobby

Submit an Answer