Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用.htaccess重定向到404页_.htaccess_Redirect_Http Status Code 404 - Fatal编程技术网

使用.htaccess重定向到404页

使用.htaccess重定向到404页,.htaccess,redirect,http-status-code-404,.htaccess,Redirect,Http Status Code 404,我在本地主机中创建了一个名为“example”的文件夹,并在该文件夹中添加了4个文件 index.php 关于.php .htaccess 404.php 当我键入url(工作正常)时,它将进入404错误页面 当我键入url时,它不会重定向到404页面。 对于示例文件夹中的about.php和其他php扩展文件也会发生同样的情况 在我的htaccess文件中,我对不存在的文件ro 404页面进行了重新定向。但是对于index.php、about.php..以及示例文件夹中所有具有php扩展名

我在本地主机中创建了一个名为“example”的文件夹,并在该文件夹中添加了4个文件

  • index.php
  • 关于.php
  • .htaccess
  • 404.php
当我键入url(工作正常)时,它将进入404错误页面

当我键入url时,它不会重定向到404页面。 对于示例文件夹中的about.php和其他php扩展文件也会发生同样的情况

在我的htaccess文件中,我对不存在的文件ro 404页面进行了重新定向。但是对于index.php、about.php..以及示例文件夹中所有具有php扩展名的文件,这种情况并没有发生

以下是我当前的.htaccess文件

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

ErrorDocument 404 /404.php

如果要显式禁用路径信息,则必须使用


我知道您对当前的.htaccess文件不满意。你能在你的问题中给出它,以便我们可以修复它吗?@dystroy…以下是我的htaccess文件。。。RewriteBase/RewriteCond%{REQUEST_FILENAME}上的RewriteEngine-f RewriteCond%{REQUEST_FILENAME}-d错误文件404/404。php@dystroy..I已在问题中添加了我的htaccess文件。请查看该文件并让我知道您的回答。@Ignacio。非常感谢您的回答。现在它工作得很好。感谢您花宝贵的时间阅读我的问题和回答。如果我在我的问题中禁用AcceptPathInfo,有什么问题吗htaccess…如果在htaccessYes中禁用AcceptPathInfo,是否有任何影响。你将无法使用任何脚本的路径信息…有任何问题与搜索引擎优化?
AcceptPathInfo Off