问题
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