Forum Moderators: phranque
I have a redirect match that works, but there are rewrite rules that happen after it that make the redirect all funky (it adds?/b-boardname/m-messagenumber/ to the end) When I do the same regexp with rewrite rule it no longer works.
Is there a way to tell RedirectMatch to not keep going (sorta like the L flag)? Or is there something special that RewriteRule needs for the regexp to work?
The URL:
/b-general/m-1139941776/
Should redirect to:
/m-1139941776/
What I'm using:
RedirectMatch ^/b-(.*)/m-(.*)/$ http://forum.example.com/m-$2/
RewriteRule ^/b-(.*)/m-(.*)/$ http://forum.example.com/m-$2/ [L]
[edited by: jdMorgan at 11:10 pm (utc) on Feb. 6, 2007]
[edit reason] Example.com [/edit]
If your code is located in .htaccess, you should know that the path to the current directory will be stripped from the URL-path seen by RewriteRule. In simple terms, that means that the leading slash will not be present in the URL-paths referring to your top-level Web-accessible directory, so your pattern won't match. Try something like:
RewriteRule [b]^b-[/b]([^/]+)/m-([^/]+)/?$ http://forum.example.com/m-$2/ [R=301,L]