简体   繁体   English

错误404页面未显示

[英]error 404 page is not displayed

I have a little problem with my ERROR 404 page. 我的ERROR 404页面有一个小问题。 In my .htaccess file I have this: 在我的.htaccess文件中,我有以下内容:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule [^/]$ %{REQUEST_URI}/ [L,R=301, NE]

the code for add "/" to the end of URL. 在网址末尾添加“ /”的代码。 This code works fine on all pages, but when I use it for error 404 page, web browser don' t show my own error 404 page, but show ERROR 403 page of my webhosting provider. 该代码在所有页面上都可以正常工作,但是当我将其用于错误404页面时,Web浏览器不会显示我自己的错误404页面,而是显示我的虚拟主机提供商的ERROR 403页面。 So, when I use " http://www.recension4u.com/error " it works fine, but when I use " http://www.recension4u.com/error/ " it makes the problem. 因此,当我使用“ http://www.recension4u.com/error ”时,它可以正常工作,但是当我使用“ http://www.recension4u.com/error/ ”时,则会出现问题。 Please can you help me? 请你能帮我吗? For all advice thanks in advance. 对于所有建议,在此先感谢。

Try with below code. 尝试下面的代码。 It may help you. 它可能会帮助您。

RewriteCond %{THE_REQUEST} ^GET
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/$ /$1 [L,R=301]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM