Click here to Skip to main content
15,113,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have designed a website Sapphire Enterprises
I want 301 redirect to http://sapphireenterprises.net/default.aspx[^] to http://sapphireenterprises.net/[^]
as it is creating duplicate content issue. For that I add following code in web config file

<system.webserver>



<rewrite>

<rule name="Canonical Host Name" stopprocessing="true">
<rule name="Strip Default.aspx Out">
<match url="(.*)default.aspx" ignorecase="false">
<action type="Redirect" url="{R:1}" redirecttype="Permanent">







but there is blue underline below rewrite and the code is not working.

I got the idea from this post
http://www.4guysfromrolla.com/articles/072810-1.aspx

But is not working. Please help me. I am using visual studio 2008 and installed IIS URL rewrite Module 2 also.
Posted
Updated 1-Apr-15 22:03pm
v3

1 solution

In the folder of your old page, add a Web.Config file and put this in the configuration tag:
XML
<location path="old.aspx">
  <system.webServer>
    <httpRedirect enabled="true" destination="new.aspx" httpResponseStatus="Permanent" />
  </system.webServer>
</location>

Important: destination has to be a path relative to old.aspx. If you want to make it relative to the root of the web server, make sure it starts with a slash.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900