Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using www.domain.com....but i need to redirect domain.com in to www.domain.com

how can i achieve this...
Posted
Updated 13-Nov-13 2:09am
v3

1 solution

I did a Google search for non www to www iis[^] and the very first link had an answer.

Copying the solution from the link -
Add below rule element to you web.config file:
XML
<rule name="Redirect to WWW" stopProcessing="true">
    <match url=".*" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^your.domain.name$" />
    </conditions>
    <action type="Redirect" url="http://www.your.domain.name/{R:0}" redirectType="Permanent" />
</rule>


Please do search before you ask.
 
Share this answer
 
v2
Comments
Member 9492907 13-Nov-13 7:42am    
i already tried it..but it is not working in iis6
Ankur\m/ 14-Nov-13 1:41am    
You mentioned you are using IIS 7. Anyways check the below link:
http://chrisburge.net/blog/redirect-non-www-www-iis-6
Again, I just typed 'non www to www iis' and one of the search suggestion by Google was 'non www to www iis 6.
Check out the other links on Google if that doesn't help too.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900