Skip to content

How to Remove www in url with htaccess?

Last updated on November 25, 2022

For SEO reasons, you might always remove (or use) the www prefix in your URLs. The following snippet will remove the www from your website URL and redirect any URL with the www to the non-www version.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^your-site.com$ [NC]
RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments