如何“不从特定页面删除'php'扩展名? [英] How "not to remove 'php' extension from specific page?

查看:61
本文介绍了如何“不从特定页面删除'php'扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编码方面的新手,需要您的帮助.我使用以下代码通过.htaccess隐藏了.php扩展名:

I am newbie in coding and need your help. I have hidden my .php extension via .htaccess with this code:

RewriteEngine on

RewriteRule ^(.+)\.php$ /$1 [R,L]

RewriteCond %{REQUEST_FILENAME}.php -f

RewriteRule ^(.*?)/?$ /$1.php [NC,END]

但是有一个页面(submit.php),需要.php扩展名才能在该页面上运行我的代码,否则显示空白页面.有什么办法可以在不删除.php扩展名的情况下将特定页面表单列入白名单?

But there is one page (submit.php) where .php extension is required to work my code in that page, otherwise it shows a blank page. Is there any way around to whitelist specific page form not to remove .php extension?

推荐答案

在htaccess文件顶部,添加以下规则:

At the top of your htaccess file ,add the following rule :

RewriteEngine on

RewriteRule ^submit\.php$ - [L]

这将从您的规则中排除/submit.php URI.

This will exclude the /submit.php URI from your rules.

这篇关于如何“不从特定页面删除'php'扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆