如何“不从特定页面删除'php'扩展名?

问题描述 投票:0回答:1

我是编码的新手,需要你的帮助。我通过.htaccess隐藏了我的.php扩展名,代码如下:

RewriteEngine on

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

RewriteCond %{REQUEST_FILENAME}.php -f

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

但是有一个页面(submit.php),其中.php扩展名需要在该页面中处理我的代码,否则它会显示一个空白页面。是否有办法将特定页面形式列入白名单而不删除.php扩展名?

.htaccess mod-rewrite php-extension
1个回答
1
投票

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

RewriteEngine on

RewriteRule ^submit\.php$ - [L]

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

© www.soinside.com 2019 - 2024. All rights reserved.