WWW Redirect Generator

Use this tool and generate 301 code to permanently redirect your domain from non-www to www or from www to non-www using htaccess

Select redirection type:

Enter your domain:

http://www.

Enter your non-www domain:

http://

Use the generated code to redirect your domain.

Create a file called .htaccess in the doc root (web / httpdocs / www folder).

Copy the code below and save it in .htaccess file to redirect all www urls to their non-www equivalents.

Create a file called .htaccess in the doc root (web / httpdocs / www folder).

Copy the code below and save it in .htaccess file to redirect all non-www urls to their www equivalents.

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