【问题标题】:404 error is not showing404 错误未显示
【发布时间】:2016-08-16 02:34:10
【问题描述】:

当我在 url 或任何任意 url 中输入 www.example.com/qqqqqq(考虑 example.com 是我的域)时,它应该显示 404 错误,但它显示 500 内部服务器错误。 这是我的 .htaccess 文件,请帮帮我。

Options All -Indexes

RewriteEngine on

RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

RewriteRule ^product-([0-9a-zA-Z]+) p.php?en=$1 [NC,L]
RewriteRule ^category/([0-9a-zA-Z]+) as.php?en=$1 [NC,L]


RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ $1\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.html [L]



#Error Pages
ErrorDocument 404 /404.php




#gzip compression

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

这是.htaccess文件,请帮帮我404.php

【问题讨论】:

  • 所以,检查你的日志

标签: php .htaccess


【解决方案1】:

尝试使用下面的.htaccess 代码。

RewriteOptions inherit
ErrorDocument 404 http://www.example.com/404.php

如果 URL 出现 404 错误,这会将用户重定向到 http://www.example.com/404.php

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-12
    • 1970-01-01
    • 2014-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多