How do I redirect my website from non-www to WWW using Apache2?
- by Andrew
I'm currently trying to set up my personal webpage.
I am using a VPS and have manually installed Wordpress, and everything seems to work... except if I go to the non-www version of my website, it comes up with a page not found.
www.andrewrockefeller.com <-- Works
andrewrockefeller.com <-- Does not (and I want to redirect it to www.andrewrockefeller.com)
I have tried adding RewriteEngine functionality to my .htaccess, and that isn't working.
I have also tried adding the 'most-voted' method of adding to my default file (which apache2.conf pulls from:
<VirtualHost *>
ServerName andrewrockefeller.com
Redirect 301 / http://www.andrewrockefeller.com/
</VirtualHost>
Seeing how many people are able to get the above working, is there something else I may be missing to allow that to function?
Thank you for your time!
EDIT: My .htaccess file is as follows:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The #Wordpress section was autocreated when I changed the settings from ?p=1 (ugly links) to prettylinks. Any proposed solutions I've found on here I've tried out and restarted apache2, and it hasn't worked.