RedirectMatch and .htaccess

software development

#1

I’ve noticed that on the Sixapart website, their track back URLs look like this:

http://www.sixapart.com/mt/trackback/82

I’ve been trying to recreate this style of URL using RedirectMatch. I was hoping that it would help me accomplish the following:

if given cleaned up url: http://example.com/trackback/65
redirect to original url: http://example.com/mt/mt-tb.cgi/65

When I ping an entry using the cleaned up URL, Movable Type says that the ping was successful, but checking the trackbacks says it wasn’t. If I paste the original url into my browser, Movable Type will tell me that I need a source url. Using the cleaned up url gives me a 404.

Here is what I have in my .htaccess file:

RedirectMatch 301 ^.*/trackback/(\d+)$ http://example.com/mt/mt-tb.cgi/$1

I put my regex in a perl script and it did what I wanted it to, but for some reason, this isn’t working. Any advice?


#2

According to Apache FAQ, “We implement a simple subset of Perl’s regex support” and that means \d doesn’t work. Use a character class instead and you’re good to go.

:cool: Perl / MySQL / HTML+CSS


#3

Your advice worked like a charm. Thanks!

Unfortunately, Movable Type doesn’t appear to be intelligent enough to understand that it should continue after it receives the 301 status code. My browser(s) on the other hand, handle everything as I’d like it to be handled. Oh well. You live, you learn.