adding www to URL with Wordpress, IIS and Mobile enabled sites (m.)

Hi Experts,

I have an issue with URL rewrite Module.
I am getting infinite loop issues.

When I type in "" I am getting infinite loop when I want it to 301 redirect to ""
Also when I type in "" I get the same error, it should redirect to ""

Wordpress v3.2.1

WordPress address (URL):
Site address (URL):

Plugins Installed:

Current IIS web.config rewrite rule
				<rule name="Redirect /(.*) to /strange-tours-melbourne/(.*) " enabled="true" stopProcessing="true">                 
					<match url="(.*)" />                    
					 <conditions logicalGrouping="MatchAny">   
						<add input="{REQUEST_URI}" pattern="^/strange-tours-melbourne/(.*)$" negate="true" />                      
					<action type="Redirect" url="http://{HTTP_HOST}/strange-tours-melbourne/{R:1}" appendQueryString="false" redirectType="Permanent" />                

Open in new window

Resources I have read and tried out

Your thoughts are appreciated.
Craig LambieAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
i'm guessing that you got it fixed as it seems to work fine from here.. except gives an error
XML Parsing Error: mismatched tag. Expected: </div>.
Line Number 102, Column 5:  </body>

Craig LambieAuthor Commented:
It does appear to be working :)
As in actually redirecting to the /strange-tours-melbourne/ virtual folder on IIS, however if I look at the server headers for with and without the www. I am getting a 200 on both now.
Ideally I want a 301 on the without, so that their is no duplicate content going on, which will require some sort of rule change?

I am not getting that error in the XML parsing on the home page... but I found one :) on another page.
I am using safari and Chrome to check the Mobile sites, and android and iphone browsers.

David Johnson, CD, MVPOwnerCommented:
the </div> in question starts on line 75 <body class="base"> <div id="wrap"> and is not closed before the </body>

well it is redirecting as it should in the url rewrite. without the rewrite you would get the 301 redirect
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Craig LambieAuthor Commented:
Not sure what browser you are using, but I get a matching <div> to that in Chrome and Safari when I run the page?

When I check the server headers on this page
I get
Response code
*200 for
200 for
301 for
301 for

What I want is 301 for * as I only want Google etc for SEO to see the one content page :)
David Johnson, CD, MVPOwnerCommented:
run your site through the w3c validator and firefox gave me the error
David Johnson, CD, MVPOwnerCommented:
check your dns settings for the and the
Craig LambieAuthor Commented:
dns settings?
What about them sorry.
They both A records point at the IP address, should one point at the domain or something?
David Johnson, CD, MVPOwnerCommented:
so you have and both pointing to your web servers ip address ergo they will give a 200 reply as there is no redirection

there are a few 404's here
8224086 ==
8224088 ==
8224089 ==

[02:34:00.786] GET [HTTP/1.1 200 OK 1872ms]
[02:34:02.629] GET [HTTP/1.1 200 OK 821ms]
[02:34:02.689] GET [HTTP/1.1 304 Not Modified 889ms]
[02:34:02.700] GET [HTTP/1.1 304 Not Modified 917ms]
[02:34:02.727] GET [HTTP/1.1 304 Not Modified 918ms]
[02:34:02.737] GET [HTTP/1.1 304 Not Modified 1571ms]
[02:34:02.758] GET [HTTP/1.1 304 Not Modified 1574ms]
[02:34:02.771] GET [HTTP/1.1 304 Not Modified 1627ms]
[02:34:02.836] GET [HTTP/1.1 200 OK 1494ms]
[02:34:04.472] GET [HTTP/1.1 302 Found 1342ms]
[02:34:04.517] GET [HTTP/1.1 200 OK 1085ms]
[02:34:04.542] GET [HTTP/1.1 404 Not Found 1704ms]
[02:34:05.980] GET [HTTP/1.1 302 Found 613ms]
[02:34:06.250] GET [HTTP/1.1 200 OK 1294ms]
[02:34:06.272] GET [HTTP/1.1 200 OK 1406ms]
[02:34:06.318] GET [HTTP/1.1 200 OK 2286ms]
[02:34:06.661] GET [HTTP/1.1 200 OK 2449ms]
[02:34:06.720] GET [HTTP/1.1 200 OK 2729ms]

Open in new window

[02:36:35.458] GET [HTTP/1.1 200 OK 1742ms]
[02:36:37.233] GET [HTTP/1.1 200 OK 928ms]
[02:36:37.268] GET [HTTP/1.1 304 Not Modified 507ms]
[02:36:37.278] GET [HTTP/1.1 304 Not Modified 525ms]
[02:36:37.291] GET [HTTP/1.1 304 Not Modified 1020ms]
[02:36:37.302] GET [HTTP/1.1 304 Not Modified 1102ms]
[02:36:37.321] GET [HTTP/1.1 304 Not Modified 1115ms]
[02:36:37.332] GET [HTTP/1.1 304 Not Modified 1141ms]
[02:36:37.381] GET [HTTP/1.1 200 OK 899ms]
[02:36:38.586] GET [HTTP/1.1 302 Found 951ms]
[02:36:38.621] GET [HTTP/1.1 200 OK 785ms]
[02:36:38.642] GET [HTTP/1.1 404 Not Found 1534ms]
[02:36:39.745] GET [HTTP/1.1 302 Found 569ms]
[02:36:40.008] GET [HTTP/1.1 200 OK 712ms]
[02:36:40.032] GET [HTTP/1.1 200 OK 765ms]
[02:36:40.080] GET [HTTP/1.1 200 OK 1008ms]
[02:36:40.150] GET [HTTP/1.1 200 OK 1526ms]
[02:36:40.237] GET [HTTP/1.1 200 OK 1748ms]

Open in new window

[02:38:00.917] GET [HTTP/1.1 200 OK 2966ms]
[02:38:03.646] GET [HTTP/1.1 404 Not Found 1972ms]
[02:38:03.655] GET [HTTP/1.1 404 Not Found 2697ms]
[02:38:03.666] GET [HTTP/1.1 404 Not Found 2818ms]
[02:38:06.530] GET [HTTP/1.1 304 Not Modified 753ms]
[02:38:06.541] GET [HTTP/1.1 304 Not Modified 784ms]
[02:38:06.555] GET [HTTP/1.1 304 Not Modified 803ms]
[02:38:06.708] GET [HTTP/1.1 200 OK 772ms]
[02:38:07.308] GET [HTTP/1.1 304 Not Modified 635ms]
[02:38:08.031] GET [HTTP/1.1 304 Not Modified 512ms]
[02:38:08.584] GET [HTTP/1.1 304 Not Modified 363ms]

Open in new window

Craig LambieAuthor Commented:
right, so that is my original question comes from, I want it to 301 redirect (it wasn't coming up at all before, but now it appears to be at least coming up)

How did you get that output? Seems like a good way to test themes etc for broken links (as you have shown :) - thanks
David Johnson, CD, MVPOwnerCommented:
firefox 7 just about the same is available with ie9 (hit f12)
Craig LambieAuthor Commented:
Ok, but still no answer to my original question - URLRewrite rule that will work to add the www. when there isn't one as a 301??
David Johnson, CD, MVPOwnerCommented:
in the www.* site create a binding
then create a blank website binding
go into the configuration editor under system.web.server/httpredirect
put the destination as the
now you should get the 301 redirects

url rewrite should always give a 200 ok response

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.