How to Remove www in url with htaccess?

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]

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

DMCA.com Protection Status