التحويل الامن الشامل 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)