*

Recent

Author Topic: Redirecting non-www to www  (Read 3113 times)

am-fs

  • Owner
  • Developer
  • Full Member
  • ******
  • Posts: 228
  • Force: +1/-0
    • Great Flash Games
Redirecting non-www to www
« on: October 26, 2014, 07:04:43 PM »
add to your .httaccess file after RewriteEngine On

For all www requests
Add:
Code: [Select]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

For all non-www request ( replace my-domain with your domain )
Add:
Code: [Select]
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC]
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L]

#1 Reason => Stops duplicate content in Google

« Last Edit: October 26, 2014, 08:00:05 PM by am-fs »