由网友(夏末初秋)分享简介:可能重复: 删除扩展名为.php用的.htaccess 我http://www.example.com/test/categoryform.php在我的.htaccess文件,我怎么重写显示为:http://www.example.com/test/categoryform/解决方案 试试这个code OUT Re...![虚拟文件夹 4.0 极速版 创建虚拟文件夹 有效保护真实文件夹](https://p.xsw88.cn/allimgs/daicuo/20230902/486.png)
可能重复: 删除扩展名为.php用的.htaccess
我
http://www.example.com/test/categoryform.php
在我的.htaccess文件,我怎么重写显示为:
http://www.example.com/test/categoryform/
解决方案
试试这个code OUT
RewriteEngine叙述上
#开启mod_rewrite的引擎
的RewriteCond%{} REQUEST_FILENAME -f .PHP
#如果请求的文件名与PHP扩展是存在的文件,
的RewriteCond%{REQUEST_URI}!/ $
#与该请求不是一个目录
重写规则(。*)$ 1 .PHP [L]
#重定向到PHP脚本与被请求的文件名
![虚拟文件夹 4.0 极速版 创建虚拟文件夹 有效保护真实文件夹](https://p.xsw88.cn/allimgs/daicuo/20230902/486.png)
和隐藏PHP扩展 - htaccess的问题也是有用的。
Possible Duplicate: remove .php extension with .htaccess
I have
http://www.example.com/test/categoryform.php
In my .htaccess file, how do I rewrite that to display as:
http://www.example.com/test/categoryform/
解决方案
try this code out
RewriteEngine On
# turn on the mod_rewrite engine
RewriteCond %{REQUEST_FILENAME}.php -f
# IF the request filename with .php extension is a file which exists
RewriteCond %{REQUEST_URI} !/$
# AND the request is not for a directory
RewriteRule (.*) $1.php [L]
# redirect to the php script with the requested filename
and hide .php extension - htaccess question is also usefull
相关推荐
最新文章