我重写了我的网址以方便用户使用.例如,我有一个名为 user.php 的页面,我将其重写为/user.但是用户仍然可以使用 user.php.如果他们请求带有 .php 扩展名的页面,我可以重定向到 404 吗?
I rewrite my urls to be user friendly. For example I have a page called user.php that I rewrite to /user. But a user can still use user.php. Can I redirect to a 404 if they request a page with a .php extension?
Options -MultiViews +FollowSymlinks -Indexes
RewriteEngine on
RewriteRule ^user/([0-9]+)$ user.php?id=$1 [L,QSA]
谢谢.
RewriteCond %{THE_REQUEST} .php[ /?].*HTTP/
RewriteRule ^.*$ - [R=404,L]
这篇关于mod_rewrite 错误 404 如果 .php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
Zend 中的动作视图助手 - 解决方法?Action View Helper in Zend - Work around?(Zend 中的动作视图助手 - 解决方法?)
这是将 URI 与 PHP 中用于 MVC 的类/方法匹配的好方Is this a good way to match URI to class/method in PHP for MVC(这是将 URI 与 PHP 中用于 MVC 的类/方法匹配的好方法吗)
我在哪里保存 Zend Framework 中的部分(视图),以便Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?(我在哪里保存 Zend Framework 中的部分(视图),以
有一个网站的单一入口点.坏的?好的?没问题?Having a single entry point to a website. Bad? Good? Non-issue?(有一个网站的单一入口点.坏的?好的?没问题?)
MVC + 服务层在 Zend 或 PHP 中常见吗?Is MVC + Service Layer common in zend or PHP?(MVC + 服务层在 Zend 或 PHP 中常见吗?)
PHP MVC 方法中的 Hello World 示例Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)