1
我用這個這個MOD改寫:httaccess URL重寫:example.com/admin/.php> example.com/admin/index
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteEngine On
RewriteBase/
RewriteCond %{HTTP_HOST} !^example.nl$ [NC]
RewriteRule ^(.*)$ http://example.nl/$1 [L,R=301]
但文我去的網頁:http://www.example.nl/admin/ 它我必須重定向到http://www.example.nl/admin/index 相反,我得到一個404的errorPage(所請求的URL /admin/.php此服務器上找到。)
我怎麼能我的子圖重定向到索引頁面?
我應該使用此代碼爲我所有的子圖? :
Redirect 301 /admin/ http://www.example.nl/admin/index
還是有更好的選擇來做到這一點?
(sry,我不是htaccess專家)
謝謝!
Thnx!它爲我工作! (: – user1167022 2012-02-20 14:18:26
@ user1167022沒問題,但已經優化並添加了一些尾部斜槓問題預防功能,U可以使用新代碼,並且在使用前清除瀏覽器的緩存。 – ThinkingMonkey 2012-02-20 14:21:34