当扩展页面是php时,htaccess显示错误页面没有更改url

时间:2016-12-12 16:38:02

标签: php apache .htaccess mod-rewrite custom-error-pages

我使用.htaccess文件隐藏页面的扩展名。

示例:page contact.php将显示联系人/

我使用此代码:

Options -MultiViews<br>
RewriteEngine On<br>
RewriteCond %{REQUEST_FILENAME} !-f<br>
RewriteRule ^([^/]+)/$ $1.php [L]<br>

如果在网址中我使用扩展名编写了网页名称而未更改网址,我该如何显示costum错误页面404?

示例:
contact.php - &gt;错误
联系/ - &gt;确定

现在,如果网址包含带扩展名的网页,我会看到一个页面,但我不想要。我希望看到没有扩展名的页面,如果包含扩展名,请显示错误页面。

有人可以帮助我吗?

由于

0 个答案:

没有答案