Last post Oct 30, 2007 09:48 AM by ijoxley
Oct 30, 2007 03:26 AM|tanhc|LINK
I tried to conduct a search for the answer and couldn't locate one in the forum. Basically what I intended to do is I got a website designed using asp.net 2.0 and let's call it
www.abc.com. I would like to redirect all the traffic accessing
www.abc.com to www.abc.com. To achieve this, I added the following line of code into my web.config file and it showed some errors.
<redirect url="^/Default.aspx$" to=http://www.abc.com
Can somebody please help to shed some light on how to amend the code to make it work? Please accept my thanks in advance.
p/s: My other url redirecting works fine using Urlrewriter.net V.2.0.
Oct 30, 2007 06:43 AM|ijoxley|LINK
I'm not quite sure what you're trying to do here. From your description it sounds like you're trying to redirect users that land on the homepage back to the homepage which doesn't make sense. Are all pages to be redirected or just Default.aspx?
Oct 30, 2007 09:40 AM|tanhc|LINK
It is for SEO purpose in fact :) Some SEO experts have recommended this to be done but I still cannot figure out exactly how to write that particular line of code in web.config.
Oct 30, 2007 09:48 AM|ijoxley|LINK
Are you just trying to replace all homepage links that contain "Default.aspx" with friendly URL's that just contain the site's domain i.e. www.abc.com? If so you might find it easier to just do a Find...Replace in Visual Studio and set all such links' href
attribute to "/" (if you are running the site locally see Scott Guthrie's post on running root sites using VS 2005: