jookr
V2EX  ›  Apache

很灵异的 apache 伪静态规则偶尔会失效 大家遇到过吗?求解决方法

  •  
  •   jookr · Aug 2, 2018 · 4279 views
    This topic created in 2861 days ago, the information mentioned may be changed or developed.

    根目录下的.htaccess 内容

    <IfModule mod_rewrite.c>
      Options +FollowSymlinks -Multiviews
      RewriteEngine On
    
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ /index.php?/$1 [QSA,PT,L]
    </IfModule>
    

    /abc/123.php 是真实存在的文件,内容是不接收传参,也没有跳转的,也就是不会收到外部影响。 根据以上规则,此 URL 是不走伪静态的,实际效果也确实如此。 但是会偶尔出现这个 url 打开的是伪静态后响应的内容 也就是 RewriteCond %{REQUEST_FILENAME} !-f 这条规则偶尔会失效,继续匹配到下面 RewriteRule ^(.*)$ /index.php?/$1 [QSA,PT,L] 这条规则上去了

    请问有经验的大佬这个问题是由于什么而引发的呢,怎么解决这个问题呢?

    1 replies    2018-08-02 14:10:45 +08:00
    jookr
        1
    jookr  
    OP
       Aug 2, 2018
    只有我这么倒霉吗?::doge::
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4925 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 93c8b4a0 · 1359ms · UTC 01:07 · PVG 09:07 · LAX 18:07 · JFK 21:07
    ♥ Do have faith in what you're doing.