Snippets

add WWW to URL

Standardizing your URL is important mostly for search engines, and like that we avoid duplicate url’s for the same page.
Add this snippet to your .htacces file, and all your URL’s will have WWW
🙂

RewriteEngine On
RewriteCond %{HTTP_HOST} ^your-site.com [NC]
RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301]

Share this snippet

 
  • And how to remove it? ^^

  • To remove WWW should be:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.your-site.com [NC]
    RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]