我需要以特殊方式编辑htaccess,即所有请求。http://www.example.com/supermega.plist或http://www.example.com/ultraturbo.plist将被重定向并由一个index.php生成。在index.php中,我还想读取plist文件名。
感谢
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)'.(plist)$ /index.php?filename=$1&ext=$2 [L,QSA]
在以下URL中:
http://127.0.0.1/somefilename.plist
您可以在$_GET
:中访问filename
和ext
print_r($_GET);
/* output
Array
(
[filename] => somefilename
[ext] => plist
)
*/