The below post shows how to redirect all non www traffic to www. For e.g. from just nixcrow.com to www.nixcrow.com
In Cpanel or Linux servers , We can do this just by adding following rewrite rules on .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
Dont forget to change the domain.com to your domain name
We can do this on IIS web server ( Windows) simply by adding the following code on web.config inside <system.webserver> element
<rewrite>
<rules>
<rule name=”Redirect domain.com to www” patternSyntax=”Wildcard” stopProcessing=”true”>
<match url=”*” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”domain.com” />
</conditions>
<action type=”Redirect” url=”http://www.domain.com/{R:0}” redirectType=”Permanent”/>
</rule>
</rules>
</rewrite>
I have tried this over many times and all the time its a success.
Post your comments
