1
我需要編輯htaccess特殊方式,所有請求,即http://www.example.com/supermega.plist或http://www.example.com/ultraturbo.plist將被重定向並由一個index.php生成。在index.php我也想讀取plist文件名。如何將所有.plist文件請求重定向到index.php
感謝
我需要編輯htaccess特殊方式,所有請求,即http://www.example.com/supermega.plist或http://www.example.com/ultraturbo.plist將被重定向並由一個index.php生成。在index.php我也想讀取plist文件名。如何將所有.plist文件請求重定向到index.php
感謝
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)\.(plist)$ /index.php?filename=$1&ext=$2 [L,QSA]
在以下網址:
http://127.0.0.1/somefilename.plist
你在$_GET
獲得filename
和ext
:
print_r($_GET);
/* output
Array
(
[filename] => somefilename
[ext] => plist
)
*/
我試過,但不起作用。斯蒂爾404 –
我在這裏試過,但也沒有工作http://htaccess.madewithlove.be –
我有一些錯誤,再試一次。 – smoqadam