homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
Help with 301 Redirection in IIS
pro_seo




msg:3590608
 7:24 am on Mar 4, 2008 (gmt 0)

Hello,

I have set up a 301 permanent redirect in my IIS which will redirect requests for domain.com to www.domain.com

This is working fine, but whenever there is a request for URLs such as

domain.com/file.aspx
domain.com/contac.aspx

..these are also getting redirected to www.domain.com

How do I fix this...I want requests for domain.com/contact.aspx to redirect to www.domain.com/contact.aspx

Another thing that I want to know is how do I redirect the index file to /

Whenever I try to redirect is through the IIS control panel by right-clicking>properties>redirect it is creating an infinite loop.

Thanks a lot in advance!

 

SEOMike




msg:3592170
 6:27 pm on Mar 5, 2008 (gmt 0)

You can redirect a specific file by right clicking the file in IIS, click "properties" and then select the radio button "A redirection to a URL. This will allow you to redirect individual pages. If contact.aspx doesn't exist in the directory anymore, just create a file named contact.aspx with notepad and then setup your redirect. Be sure to check the box that says "a permanent redirection..."

Whenever I try to redirect is through the IIS control panel by right-clicking>properties>redirect it is creating an infinite loop.

Not sure what you mean by this... Could you elaborate please?

mattur




msg:3592175
 6:36 pm on Mar 5, 2008 (gmt 0)

See this thread: Domain level 301 redirect clips the query strings [webmasterworld.com] (it describes redirecting urls and query strings at the site level). HTH.

duckhunter




msg:3592495
 1:31 am on Mar 6, 2008 (gmt 0)

Another option for you that I use to solve the cononical URL issue. Place this in the Global.asax Application_BeginRequest Sub.

If Request.ServerVariables("HTTP_HOST") = "mydomain.com" Then
Response.Status = "301 Moved Permanently"
Response.AddHeader("Location", "http://www.mydomain.com" & Request.RawUrl)
End If

pro_seo




msg:3592657
 6:35 am on Mar 6, 2008 (gmt 0)

Thanks friends for your replies,

I have fixed the first problem, now let me share with you all how I did it:

I created a site in the IIS with domain.com as the host name and then 301 redirected it [by right click > properties] to www.domain.com$S I was missing the $S part for which requests for domain.com/contact.aspx was getting redirected to www.domain.com. The redirect wasn't passing any suffixes. So I fixed that and it's working fine. Thanks again!

Now the BIG problem (for me at least)

How do I redirect www.domain.com/default.aspx to www.domain.com/

I have tried numerous ways of doing this, but it just doesn't work. I would be very grateful if you all can guide me through this.

Thanks a lot in advance :-)

coffeebean




msg:3595781
 8:30 pm on Mar 9, 2008 (gmt 0)

Pretty sure you need to add $Q in order to preserve the querystring on the redirect target. So for example in the "Redirect to" field you need: [domain.com$S$Q...]

To redirect "/default.aspx" to "/" I think you have to use IsapiRewrite or similar.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved