我得到了文件名的静态页面,如:atatat.php?article = 3
我需要将它们作为html处理。全部在文件名中匹配“atatat.php”。
和其他页面一样,常规* .php没有“atatat.php”在url进程中像往常一样匹配php,是否可以使用nginx配置?
您可以使用nginx正则表达式匹配:
location ~* atatat.php {
// this will match any url that contains `atatat.php`
// do whatever you want with them here
}
location ~* [^(atatat)].php {
// this will match any url that **doesn't** contain `atatat.php`
// do whatever you want with them here
}
~*
告诉nginx将下一部分视为不区分大小写的正则表达式。如果您需要区分大小写,请使用~
(删除星号)。