Reputation: 11
Hope you all are spending a great time in this forum. Today I joined this forum and come with a problem. My problem is that...
Recently i created a website and when I create its pages then 1 page name is misspell. Now I want to redirect this page to real page name. I am using this code:
<system.web>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"></modules>
<httpHandlers>
<add verb="*" path="misspell url " type="UrlRedirection" validate="false" />
</httpHandlers>
</system.web>
This code is fine in local server but when I upload this code on server its show 500 internal server error.
Points: • We used godaddy hosting , IIS 7 .
Need help!
Thanks in Advanced.
Upvotes: 1
Views: 1111
Reputation: 13125
Good news, you are using IIS7 and your GoDaddy hosting supports the UrlRewrite module:
This means you do the following:
<httpHandler>
<add />
that you have set up.<system.webServer>
in your web.configCode:
<rewrite>
<rewriteMaps>
<rewriteMap name="StaticRewrites" defaultValue="">
<add key="/oldurl.aspx" value="/newurl.aspx" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="RewriteMap Rule">
<match url=".*" />
<conditions>
<add input="{StaticRewrites:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" />
</rule>
</rules>
</rewrite>
You can add as many of these rows as you like if you want to redirect several pages:
<add key="/oldurl.aspx" value="/newurl.aspx" />
I just double checked this on my server and it produces a 301 redirect (which is a permanent, seo friendly redirect).
Upvotes: 4