Hi folks, I have a dedicated server which hosts only one site. When I enter the ip address of the server into a browser I get the default apache index page. I would like to redirect the ip address to the domain. I tried to do it using htaccess rewrite rules but it doesn't appear to work or I've done it wrong. RewriteCond %{HTTP_HOST} ^123\.45\.67\.89 RewriteRule (.*) http://www.example.com/$1 [R=301,L] Code (markup): Thanks for any help!
Well, I am not an expert in this, but I suggest you could try using the Virtual Hosts module on your httpd.conf (I suppose you are using apache) to point that ip to a specific directory, where you can place the .htaccess file with the 301 redirection. Let me know if this works.
Setting up a VirtualHost is the correct way to do it but you could put a regular htaccess redirection on it.