【发布时间】:2018-10-31 13:18:00
【问题描述】:
我的 .htaccess 规则会从 URL 中删除所有 .html 和 .php 扩展名。
但是我需要从该规则中排除一个特定的.php 文件,例如文件mailscript/sendmail.php
根据我现在的当前规则配置,这怎么可能?
.htaccess
AddType text/html .shtml
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes
AddHandler server-parsed .html .htm
RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]
我尝试基于on this answer 应用RewriteRule ^sendmail\.php$ [L],但它不适用于我当前的规则。
【问题讨论】: