我有包括重定向URL來www.site.com/machines/重定向到頁面如何將www.site.com/index.php/重定向到www.site.com/index.php?
RewriteRule ([^/\.]+)/$ index.php?task=cat&p_name=$1 [L]
爲客戶想優化URL的名字,而不是ID
但在情況下,顯示機index.php www.site.com/index.php/它應該重定向到索引頁面。 我厭倦了使用這種條件下,重寫URL
RewriteCond %{REQUEST_URI} !^/index.php/$ [NC]
之前,但這不是完全重定向到頁面www.site.com/index.php。 因此一些CSS和圖像無法正確顯示 所以,我想另一種方式
RewriteCond %{REQUEST_URI} ^/index.php/$ [NC]
RewriteRule ^index.php/$ index.php? [R=301,L]
這被重定向這樣 http://www.site.com/home/user/public_html/www.site.com/index.php 請幫我重定向URL感謝
這是奇怪的行爲。你的.htaccess文件中有一個RewriteBase指令嗎?如果是這樣,可能會註釋掉RewriteBase指令並查看是否可以解決問題。 – Bobulous 2013-04-06 15:41:30