How to redirect all traffic to ‘www’ to your website domain without the prefix

This article explains how to redirect all traffic directed at “www” to your website domain without the “www”.

Create a .htaccess file in the root of your website folder. Add the following contents into it:

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewiteRule ^ https://%1%{REQUEST_URI} [L,R=301]

Share this article

Leave a Reply

Your email address will not be published.

Scroll to Top