0

I am trying to use URL Rewrite module on IIS7 to do the following redirection/rewrite (don't know what's better for my case):

I want this URL "http://myServer/" to be redirected/rewritten to "http://myServer/sites/site1".

Thanks alot in advance, any help would be greatly appreciated :)

YASH23

YASH23
  • 1

1 Answers1

0

If this is the only redirect you'll be doing, the rewrite module is going to be more confusing than necessary if you're not already familiar with it. I recommend creating a Default site that loads when you go to the root URL (http://myServer/), with the following code in a file named default.asp:

<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://myServer/sites/site1"
%>

That will do a permanent redirect. If you'd rather do a temporary redirect (so search engines will check there later), do a 302 redirect:

<%
Response.Redirect "http://myServer/sites/site1"
Response.End
%>

Or, if you'd like to still use IIS URL Rewrite, the regex should just check for an empty string:

^$
Michael Cox
  • 1,281
  • 13
  • 15
  • Michael, First of all, thanks for the response.. appreciate it.. I wonder why would it be confusing to use the rewrite module in my case, logically it should do what I need.. but none of the pattern regular expressions is working so far.. The redirect solution wouldn't help, since I might need to access the root site .. Any regex help would be greatly appreciated – YASH23 Dec 19 '11 at 07:42
  • @YASH23 - I updated it if you still want to use URL Rewrite. I just thought if you're not used to doing rewrites, doing a redirect may be easier to manage long term. – Michael Cox Dec 19 '11 at 16:07