views:

266

answers:

1

Here's what I need-

  1. RegEx to match a url pattern and rewrite it to something else
  2. 301 redirect old pattern to new pattern

Here's what I have-

I have a url pattern that currently looks like this--

http://www.foo.com/press/index.php/2009/4-reasons-to-buy-now/

I want to create a pattern match on the url "http://www.foo.com/press/index.php/" and rewrite to remove the "/index.php" and the new url would be--

http://www.foo.com/press/2009/4-reasons-to-buy-now/

But I want that as a pattern match on the redirect and rewrite so other urls will also be stripped of the "/index.php" which will always fall after the http://www.foo.com/press/

Thanks for your help in advance!

+4  A: 
RewriteRule ^press/index.php/(.*) /press/$1 [R=301]
chaos