2

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?

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

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.

0
<?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>
-2

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

3
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy