jookr
V2EX  ›  问与答

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

  •  
  •   jookr · Aug 3, 2018 · 1686 views
    This topic created in 2846 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-03 16:39:50 +08:00
    jookr
        1
    jookr  
    OP
       Aug 3, 2018
    有没有大哥帮忙解答一下呢 -_-!!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3918 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 00:55 · PVG 08:55 · LAX 17:55 · JFK 20:55
    ♥ Do have faith in what you're doing.