Not sure what you're looking for?

Book a call

Hello, Redditor! To say thank-you to our friends from Reddit, we have an exclusive offer. Use code REDDIT to get your first month for £1. Applies to monthly plans only.

Gnu Host is now . See our announcement Zume for more details.

You are on our site Visit our site 

How to redirect my website to www/non-www

Here’s a quick guide on how to redirect to www and non-www using .htaccess:

To redirect to www:

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

To redirect to non-www:

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

Simply add the appropriate code to your website’s .htaccess file to apply the redirection.

See also: How to edit .htaccess

Need help?

Can't find what you're looking for? Our support team is here to help.