0
votes

I have the following code in my Root htaccess file

RewriteCond %{HTTP_HOST} ^paperviewmagazine.com RewriteRule (.*) http://www.paperviewmagazine.com/$1 [R=301,L]

It works fine for the main site, but for my forums at /forums/ if someone misses off the www it will show the page and not redirect to the www.paperviewmagazine.com/forums/ instead.

I need to force the WWW to prevent anyone from logging in by accident on the non-www as it wont have the correct cookie credentials for accessing the site at www./forums/

Can anyone help?

Thanks.

1
Oh my bad, last I looked it said 0%.Mitch Dempsey

1 Answers

0
votes

If you are just trying to route "site.com" to "www.site.com" then do:

RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/?(.*)         http://www.example.com/$1 [L,R=301,NE]