2011-05-12 90 views
0

我查看了相关的问题,但没有运气。mod_rewrite重定向问题

我试图改写这样的事情:http://www.example.com/v2/index.php/en/company/careers/training-and-implementation-specialist/

这样:http://www.example.com/en/company/careers/training-and-implementation-specialist/

为了让事情变得更加混乱,“的index.php”在上面的URL是一个文件,而不是目录。我试图做一个规则,其中www.example.com/v2/index.php/ (任何)变成www.example.com/ (任何)

我觉得这应该是很容易,我试过这个:RewriteRule^v2/index.php /(.*)/ $ 1 [L]

但是没有运气 - 它会在/v2/index.php中得到404'd的任何东西。

有什么建议吗?

回答

0

如果我明白你想要做什么,我相信你已经倒退了。试试这个:

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ v2/index.php/$1 [L] 
0

问题是与指数和PHP之间.RewriteRule ^v2/index.php/(.*) /$1 [L]

要重写试戴RewriteRule ^v2/index\.php/(.*)$ /$1 [L]

如果你想重定向,改变[L][R,L]