1

我有更改扩展名的规则

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^item/(.*)/?$ item.php/$1 [NC,L]
RewriteRule ^([^.]+)$ $1.php [NC,L]

一切都很好但是这条规则也过滤了苹果应用网站关联

需要跳过 apple-app-site-association 但过滤其他

我尝试在下面添加代码但无济于事

RewriteRule ^apple([a-z]+)$ $1 [NC,L]
RewriteRule apple-app-site-association$ $1 [NC,L]
RewriteRule ^apple([a-z]+)$ $1 [NC,L,S=2]
4

1 回答 1

2

您可以使用以下内容:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^item/(.*)/?$ item.php/$1 [NC,L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^.]+)/?$ $1.php [NC,L]

上述条件确保您不会重写现有文件和文件夹。

于 2021-12-04T11:44:25.377 回答