删除php/html扩展名并从规则中排除一个特定文件
我的删除php/html扩展名并从规则中排除一个特定文件,php,.htaccess,url,Php,.htaccess,Url,我的.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 .
.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]
我试图应用基于
的重写规则^sendmail\.php$[L]
,但它不适用于我当前的规则。您可以将此规则添加到跳过sendmail.php
:
RewriteRule (?:^|/)sendmail\.php$ - [L,NC]
在行的重写引擎下方添加此规则