【问题标题】:Under what situation will .htaccess not work for Apache?在什么情况下 .htaccess 对 Apache 不起作用?
【发布时间】:2009-09-30 06:18:14
【问题描述】:

vi .htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|audio|editor|upload|images|js|css|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ /index.php?$1 [L]

当我尝试浏览 http://wolaitiao.cn/install,it 时报告 404,因此无法正常工作。

是因为它是虚拟主机吗?

<VirtualHost *:80>
...

【问题讨论】:

    标签: apache .htaccess rewrite


    【解决方案1】:

    检查 apache 错误日志

    【讨论】:

      【解决方案2】:

      首先确保为 Apache 启用了重写,并且 .htaccess 文件符合规则。

      那么您可以简单地将任何物理上不存在的东西重定向到索引:

      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-l
      RewriteRule .* index.php [QSA,L]
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-05-11
        • 1970-01-01
        • 2014-09-29
        • 1970-01-01
        • 2015-05-26
        • 2023-03-18
        • 1970-01-01
        相关资源
        最近更新 更多