How "not to remove 'php' extension from specific page?

寵の児 提交于 2019-12-11 14:36:28

问题


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]

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?


回答1:


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

RewriteEngine on

RewriteRule ^submit\.php$ - [L]

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



来源:https://stackoverflow.com/questions/47961646/how-not-to-remove-php-extension-from-specific-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!