Hello,
I have just registered a domain. How can I setup DNS to have a foo.com and a www.foo.com domain?
How can I set Apache to automatically redirect all foo.com requests to www.foo.com?
The websites for both domains are hosted on the same server.
I had this problem some time ago. This fixed it, and works with all sub-directectories under foo.com without getting a 404 error.
Code:;DNS Zone File ;============= foo.com. IN A 11.12.13.14 www IN A 11.12.13.14 # httpd.conf file #================ <VirtualHost *:80> ServerName www.foo.com DocumentRoot /var/www/html/foo </VirtualHost> <VirtualHost *:80> ServerName foo.com Redirect / http://www.foo.com/ </VirtualHost>
Bookmarks