ÇáÊÍæíá ÇáÇãä ÇáÔÇãá Non-www to www 301 redirection

ÇáßæÏ Ýì ÇáÇÓÝá ÝßÑå ÇáÚãá Èå ãä 3 ÓØæÑ , ÇáÇÓØÑ ÇáËÇäì ßÇäå find æÇáÓØÑ ÇáËÇáË ßÇäå replace

Another common thing I usually do for my clients is to redirect non-www version of their vbulletin forums to www-version.
This can be easily achieved by creating a .htaccess file which contains

ßæÏ:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
Just replace domain.com with your domain name and upload the file to the /public_html folder


If your forums are in a subfolder, i.e. /forum, you should put this .htaccess file IN that folder.
/forum/.htaccess:

ßæÏ:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/forum/$1 [R=301,L]

The sessions might not work (cookies issues) if you set the “forum url” (in “ACP -> Sitename/URL/Contact info”) to: domain.com instead of www.domain.com
Do not forget to check this if the sessions don’t work (this is, your login is right, but next time you click any link in the forum, you are unlogged)