如何将所有.plist文件请求重定向到index.php


How to redirect all .plist file requests to index.php

我需要以特殊方式编辑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:中访问filenameext

print_r($_GET);
/* output
Array
(
    [filename] => somefilename
    [ext] => plist
)
*/