Here's what I need-
这就是我需要的 -
- RegEx to match a url pattern and rewrite it to something else
- 301 redirect old pattern to new pattern
RegEx匹配url模式并将其重写为其他内容
301将旧模式重定向到新模式
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/index.php/”上创建一个模式匹配,并重写以删除“/index.php”,新的网址将是 -
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/
但是我希望它作为重定向和重写的模式匹配,所以其他网址也将被剥夺“/index.php”,它将始终落在http://www.foo.com/press/之后
Thanks for your help in advance!
感谢您的帮助!
1 个解决方案
#1
RewriteRule ^press/index.php/(.*) /press/$1 [R=301]
#1
RewriteRule ^press/index.php/(.*) /press/$1 [R=301]