How do I redirect my website from non-www to WWW using Apache2?
Posted
by
Andrew
on Server Fault
See other posts from Server Fault
or by Andrew
Published on 2013-10-31T19:25:23Z
Indexed on
2013/10/31
21:58 UTC
Read the original article
Hit count: 349
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.
© Server Fault or respective owner