URL Rewriting

Oct 9, 2009 at 3:06 PM
Edited Oct 9, 2009 at 4:24 PM

Anyone having luck with url rewriting.

 

 

I tried regex rewriter here (which sounds fantastic):

http://www.dexign.net/post/2008/08/05/URL-Rewriting-Extension-For-BlogEngine.aspx

But so far just getting web.config error:  "must declare a body because it is not marked abstract or extern"

 

 

 I tried the managed fusion described here, and tried the example config file settings provided there:

http://www.codeplex.com/blogengine/Thread/View.aspx?ThreadId=17357

and so far it doesn't seem to do anything when served inside visual studio 2005.  Does it require some special coding for blog engine?

Thanks

Coordinator
Oct 10, 2009 at 8:40 AM

I haven't used those URL rewriters before.  If your site is on IIS7, you might want to try the Url Rewrite Module that is free for IIS7.  I'm using it for some non-BE websites, and it's working well.  I haven't yet tried the URL Rewrite Module with BE.

For those other rewriters you're trying, it's possible you need to launch your website with IIS, rather than using the built-in Visual Studio web server.  It depends on how the rewriters work.

Oct 16, 2009 at 2:29 AM

Thanks Ben!

I've decided that rewriting url's is too complicated for me and I can be content with "/page/", in addition to performing 301 redirects for all my old, pre-blogengine pages.

For other simpletons like me:

For each page you want to redirect, just create an aspx page in the root folder using the old name, but add this script:

 

<script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
        Response.Status = "301 Moved Permanently";
        Response.AddHeader("Location", BlogEngine.Core.Utils.RelativeWebRoot + "page/podiatry.aspx");
    }
</script>
<script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
        Response.Status = "301 Moved Permanently";
        Response.AddHeader("Location", BlogEngine.Core.Utils.RelativeWebRoot + "page/NewPageName.aspx");
    }

</script>