【问题标题】:.htaccess skip apple-app-site-association but filter other.htaccess 跳过 apple-app-site-association 但过滤其他
【发布时间】:2022-01-10 11:00:18
【问题描述】:

我有更改扩展名的规则

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]

【问题讨论】:

    标签: apache .htaccess mod-rewrite skip apple-app-site-association


    【解决方案1】:

    您可以使用以下内容:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-28
      • 2017-02-16
      • 2021-06-29
      • 1970-01-01
      • 1970-01-01
      • 2016-01-06
      • 2021-09-13
      相关资源
      最近更新 更多