简体   繁体   English

.htaccess 跳过 apple-app-site-association 但过滤其他

[英].htaccess skip apple-app-site-association but filter other

I have a rule for changing the extension我有更改扩展名的规则

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

All fine But this rule also filter apple-app-site-association一切都很好但是这条规则也过滤了苹果应用网站关联

Need skip apple-app-site-association but filter other需要跳过 apple-app-site-association 但过滤其他

I tried add code below but to no avail我尝试在下面添加代码但无济于事

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

You can use the following:您可以使用以下内容:

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

The condition above makes sure you don't rewrite your existing files and folders.上述条件确保您不会重写现有文件和文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM