Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have created an ASP.NET site to replace a WordPress site that creates permalinks in the format:

http://example.com/the-name-of-my-post

I would like these URLs redirected to:

http://example.com/Default.aspx#&&the-name-of-my-post

...which is what the ScriptManager generates at runtime.

The WordPress site was around for about 2 years so there are lots of bookmarks and references to these "permalinks" on the search engines etc.

Are there any modules I have to include in my website to get this to work? Is there any configuration that I have to ask my hosting company to make so that this works?

share|improve this question

migrated from stackoverflow.com Jun 23 '12 at 9:15

This question came from our site for professional and enthusiast programmers.

    
Are you using Webforms or MVC? –  Dave Jul 23 '12 at 11:38

3 Answers 3

mod_rewrite: http://www.phatz.com/301redirect.php

share|improve this answer
    
Wat? Why the downvote? –  HaloWebMaster Jun 21 '12 at 15:51
3  
Because your answer is wrong. You can't use mod_rewrite on IIS and the method in the link you gave is very out of date and a time consuming way of doing it. –  mattmanser Jun 21 '12 at 16:19
    
When someone mentions ASP.NET and hosting it's a safe assumption they're hosting on an IIS not a Linux box. –  Anagio Jun 24 '12 at 7:54

IIS 7.0 rewrite module documentation

http://learn.iis.net/page.aspx/734/url-rewrite-module/

Also IIS redirects http://knowledge.freshpromo.ca/seo-tools/301-redirect.php#aspnet

IIS does not support .htaccess so creating many re-written URL's takes a little more manual work.

share|improve this answer
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
            <rewrite>
    <rules>
        <rule name="Enforce canonical hostname" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTP_HOST}" negate="true" pattern="^www\.example\.com$" />
            </conditions>
            <action type="Redirect" url="http://www.example.com/Default.aspx#&&{R:1}" redirectType="Permanent" />
        </rule>
        <rule name="Remove .asp extension" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add matchType="IsFile" negate="true" />
                <add matchType="IsDirectory" negate="true" />                  
            </conditions>
            <action type="Rewrite" url="{R:1}.asp" />
            </rule>
    </rules>
</rewrite>
    </system.webServer>
</configuration>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.