2011-05-12 89 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]