我認爲在我的htaccess代碼中有一些問題,但我無法弄清楚。使用Htacess刪除文件夾名稱
我需要的是。
1)從像www.domain.com/index代替www.domain.com/index.php
2的地址PHP擴展)卸下文件夾名稱。我的網站文件存儲在一個名爲public的文件夾中。我想刪除它。 www.domain.com/public/index.php到www.domain.com/index
我寫了下面的代碼,請讓我知道這是什麼錯誤。
# This will hide the folder name public and the php text
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+public/([^\s]+) [NC]
RewriteRule^%1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
# if you face any problem than try to uncomment the below line and delete the line after it
RewriteRule (?!^public/)^(.*)$ public/$1 [L,NC]
可能重複:[刪除擴展名爲.php與的.htaccess(http://stackoverflow.com/questions/4026021/remove-php -extension-with-htaccess) – Azrael 2014-09-24 06:42:23
1)使用'選項+多視圖' – Phil 2014-09-24 06:42:52
有人可以告訴我爲什麼這是downvoted? – user3477550 2014-09-24 07:15:36