tags:

views:

156

answers:

2

So I'm running subtext 1.95 on IIS6 and .net 2.0 framework. What I'd like to do is create a nice vanity URL to a particular article that is published inside the subtext system. The vanity url should look like this: mydomain.com/blog/toc/, but the subtext article that it is pointing to actually has a path like this: mydomain.com/blog/archive/2009/01/11/table-of-contents.aspx

I can probably just set up a forward within IIS to do this, but I'm looking for a more elegant solution that doesn't require any custom IIS configurations like that. I'd also like to refrain from changing any of the subtext core code, as to leave an upgrade path for myself.

Is the best solution to just put a default.aspx file inside the /toc/ folder and have that page forward on to the long path?

Thanks in advance!

+2  A: 

Note, this applies to Subtext 2.1.2 and below

URL matching is handled in Web.config. You can search for a line that looks like this:

<HttpHandler pattern="(?:/archive/\d{4}/\d{2}/\d{2}/[-_,+\.\w]+\.aspx)$" controls="viewpost.ascx,Comments.ascx,PostComment.ascx"/>

And change the regex there. Unfortunately, Subtext will continue to generate the old links. In the upcoming Subtext 2.5, the situation improves slightly.

One other problem is that with IIS 6, unless the /toc/ directory physically exists, IIS won't hand off the request to ASP.NET, so you'd need to use wildcard mapping to actually make that work.

For now, I think you might need to do this via some sort of URL rewriting isapi filter in IIS to achieve exactly what you want.

Haacked
A: 

Thanks for the information Phil.

I ended up just creating a /toc/ folder, and having a default.aspx file that redirects to the blog article. This is probably the easiest solution, and only took me a minute to implement.

Rafe