htaccess rewrite to remove www prefix
If you are looking for a way to “force” website traffic to not use www., then here is an .htaccess rule you can use
RewriteEngine On
# If subdomain www exists, remove it
RewriteCond %{HTTP_HOST} ^www\.([^\.]+\.[^\.]+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
There are other useful .htaccess tips at the following URL:
Leave a Reply
You must be logged in to post a comment.
