我在我的localhost中创建了一个名为“example”的文件夹,并且我在该文件夹内添加了4个文件。使用.htaccess重定向到404页面
- 的index.php
- about.php
- 的.htaccess
- 404.php
当我键入URL http://www.localhost/example/123(工作正常)这是要404错误页面。
当我输入url http://www.localhost/example/index.php/123它没有重定向到404页面。 在示例文件夹中发生about.php和其他php扩展文件。
在我的htaccess文件中,我重新指出了不存在的文件ro 404 pages.But并没有发生index.php,about.php ..以及所有带有php扩展名的示例文件夹中的文件。
以下是我当前的.htaccess文件。
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
ErrorDocument 404 /404.php
我知道您对当前的.htaccess文件不满意。你可以在你的问题中提出这个问题,以便我们解决它吗? –
@dystroy ...以下是我的htaccess文件... RewriteEngine叙述在 RewriteBase/ 的RewriteCond%{} REQUEST_FILENAME!-f 的RewriteCond%{} REQUEST_FILENAME!-d 的ErrorDocument 404 /404.php – Imthiyaz
@dystroy ..我已经在问题中添加了我的htaccess文件..请看看它,让我知道你的回应。 – Imthiyaz