简体   繁体   English

使用.htaccess发生404错误

[英]Usage of .htaccess for 404 error

I am using .htaccess in my project, i just use the following code 我在我的项目中使用.htaccess,我只使用以下代码

ErrorDocument 404 /404.php ErrorDocument 404 /404.php

in the .htaccess inside the root folder, but it does not redirect to 404.php while trying to open the misspelt webpage. 在根文件夹内的.htaccess中,但在尝试打开拼写错误的网页时,它不会重定向到404.php。

I want to know whether there is syntax error in the .htaccess file. 我想知道.htaccess文件中是否存在语法错误。

I used .html file instead for .php file. 我使用.html文件代替.php文件。 but it throws the same error. 但它会抛出同样的错误。


Not Found 未找到

The requested URL /ht/re was not found on this server. 在此服务器上找不到请求的URL / ht / re。

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。

first you have to locate your errorpage 首先,你必须找到你的错误

ie on local server my 404.php in root/error then 即在本地服务器上我的404.php在root /错误然后

ErrorDocument 404 /error/404.php ErrorDocument 404 /error/404.php

here first slash is root of server 这里第一个斜杠是服务器的根

your server could not find 404.php thats problem so locate your 404.php 你的服务器找不到404.php那个问题所以找到你的404.php

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

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