Remove IP address from the URL of website using apache

Posted by sapatos on Pro Webmasters See other posts from Pro Webmasters or by sapatos
Published on 2014-02-09T09:06:27Z Indexed on 2014/06/10 3:44 UTC
Read the original article Hit count: 390

Filed under:
|

I'm on an EC2 instance and have a domain domain.com linked to the EC2 nameservers and it happily is serving my pages if I type domain.com in the URL.

However when the page is served it resolves the url to: 1.1.1.10/directory/page.php.

Using apache I've set up the following VirtualHost, following examples provided at http://httpd.apache.org/docs/2.0/dns-caveats.html

Listen 80
NameVirtualHost 1.1.1.10:80

<VirtualHost 1.1.1.10:80>

DocumentRoot /var/www/html/directory
ServerName domain.com

# Other directives here ...

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>
</VirtualHost>

However I'm not getting any changes to how the URL is displayed.

This is the only VirtualHost configured on this site and I've confirmed its the one being used as I've managed to break it a number of times whilst experimenting with the configuration.

The route53 entries I have are:

domain.com A 1.1.1.10
domain.com NS ns-11.awsdns-11.com 
         ns-111.awsdns-11.net 
         ns-1111.awsdns-11.org 
         ns-1111.awsdns-11.co.uk
domain.com SOA ns-11.awsdns-11.com. awsdns-hostmaster.amazon.com. 1 1100 100 1101100 11100

© Pro Webmasters or respective owner

Related posts about apache

Related posts about amazon-ec2