• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Redirecting forum non-www to www

vexx

Active member
#1
Hey guys,

Just want to redirect the non-www version of the forum to the www one. Basically, site.com/forums/ to always redirect to www.site.com/forums/

I tried adding this to the .htaccess but with no luck.

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

PHP:
RewriteCond %{HTTP_HOST} ^site.com/forums
RewriteRule (.*) http://www.site.com/forums/$1 [R=301,L]
Tnx in advance for any tips
 

oldzy

Active member
#2
This is what I have in my Apache conf file...

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([a-z.]+)$ [NC]
RewriteRule ^/(.*)$ http://www.%1/$1 [R,L]