Monday, February 19, 2018

Wordpress - Redirect www URLs to non-www

You can redirect all of the requests for www.yourdomain.com domain to yourdomain.com by modifying your website's .htaccess file. You need to add the following lines at the beginning of the file in order to setup that redirection:


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


Where yourdomain.com is your actual domain name.

No comments: