htaccess force www - no www


/ Published in: HTML
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Force the www.
  2.  
  3. RewriteEngine On
  4. RewriteCond %{HTTP_HOST} ^your-site.com [NC]
  5. RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301]
  6.  
  7. Remove the www.
  8.  
  9. RewriteEngine On
  10. RewriteCond %{HTTP_HOST} !^your-site.com$ [NC]
  11. RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.