This page looks best with JavaScript enabled

How to redirect www URLs to non-www?

 ·  ☕ 1 min read  ·  👽 john hashim

To redirect all requests to non-www, add the following lines at the beginning of your website’s .htaccess file:

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

Replace domain.com with your actual domain name.

Share on

john hashim
WRITTEN BY
john hashim
Web Developer