Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am having trouble with redirecting my website from domain.com to www.domain.com. I have used the following line of code in the urlrewriting.config file and it does not seem to be working.
<add name="Non_WWW_Domain" virtualUrl="http://domain.com/(.*)" rewriteUrlParameter="IncludeQueryStringForRewrite" destinationUrl="http://www.domain.com/$1" redirectMode="Permanent" redirect="Domain" ignoreCase="true" />
Any help would be great thanks.
Hi Ryan and welcome to our :-)
What if you do something like this.
<add name="nonWWW" redirectMode="Permanent" redirect="Domain" ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite" virtualUrl="http://domainname.com/(.*)" destinationUrl="http://www.domainname.com/$1" />
Hope this helps,
/Dennis
Hi Dennis,
I tried that and I am still getting a 404 error page when I enter the http://domain.com address.
Thanks for the help
Have you recycled the application pool after adding that rule?
Ryan,
Have you tried setting a Canonical Host Name in IIS ?
Add this to your web.config (replacing "domain.com" with whatever your actual domain is):
<system.webServer> <rewrite> <rules> <rule name="Redirect non-www to www" enabled="true" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^domain.com$" /> </conditions> <action type="Redirect" url="http://www.domain.com/{R:0}"/> </rule> </rules> </rewrite> </system.webServer>
You may have to install Application Request Routing (ARR) 3.0 in IIS for that to work.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Non www redirect to www
I am having trouble with redirecting my website from domain.com to www.domain.com. I have used the following line of code in the urlrewriting.config file and it does not seem to be working.
Any help would be great thanks.
Hi Ryan and welcome to our :-)
What if you do something like this.
Hope this helps,
/Dennis
Hi Dennis,
I tried that and I am still getting a 404 error page when I enter the http://domain.com address.
Thanks for the help
Have you recycled the application pool after adding that rule?
Ryan,
Have you tried setting a Canonical Host Name in IIS ?
Add this to your web.config (replacing "domain.com" with whatever your actual domain is):
You may have to install Application Request Routing (ARR) 3.0 in IIS for that to work.
is working on a reply...