Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite (301)

         

Nick0r

10:41 pm on Oct 8, 2006 (gmt 0)

10+ Year Member



Hello,

I'm wondering if anyone can help me make a 301 mod rewrite rule for the following problem:

Old URLs are in this format:

www.domain.com/t12345-blah-blah.html

Now these are forum threads, so the numbers and words change.

So I'd need the rule for:

www.domain.com/t[5-6digits here]*

to

www.domain.com/showthread.php?t=[the-digits-from-above]

Thanks very much for the help.

jdMorgan

1:12 pm on Oct 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We can't write your code for you here (please see our forum charter), but the two keys to your problem are the pattern matching provided in mod_rewrite by the use of regular expressions, and the back-reference capability of mod_rewrite that allows you to 'copy' parts of the requested URL that match your pattern(s) into the new URL produced by the RewriteRule.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim