htaccess是否重写除一个php文件以外的所有文件?
如何重写除一个“logout.php”之外的所有文件 我试过了,但它给了我一个404:htaccess是否重写除一个php文件以外的所有文件?,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,如何重写除一个“logout.php”之外的所有文件 我试过了,但它给了我一个404: <IfModule mod_rewrite.c> RewriteEngine on # You may need to uncomment the following line if rewrite fails to work # RewriteBase must be setup to base URL of your aMember installation without #
<IfModule mod_rewrite.c>
RewriteEngine on
# You may need to uncomment the following line if rewrite fails to work
# RewriteBase must be setup to base URL of your aMember installation without
# domain name
RewriteBase /amember4
RewriteCond %{REQUEST_URI} !^/logout\.php$ [NC]
RewriteRule ^public public.php [L]
RewriteRule ^js.php js.php [L]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|csv|html)$ index.php
</IfModule>
重新启动发动机
#如果重写失败,您可能需要取消对以下行的注释
#RewriteBase必须设置为您的aMember安装的基本URL,而无需
#域名
重写BASE/amember4
重写cond%{REQUEST_URI}^/注销\.php$[NC]
重写规则^public.php[L]
重写规则^js.php js.php[L]
重写规则!\。(js | ico | gif | jpg | png | css | swf | csv | html)$index.php
重写条件仅适用于下一个重写规则。因此,您必须重复它,或者在本例中,在第三条规则之前向下移动它:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /amember4
RewriteRule ^public public.php [L]
RewriteRule ^js.php js.php [L]
RewriteRule ^logout.php logout.php [L]
RewriteCond %{REQUEST_URI} !^/logout\.php$ [NC]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|csv|html)$ index.php
</IfModule>
重新启动发动机
重写BASE/amember4
重写规则^public.php[L]
重写规则^js.php js.php[L]
重写规则^logout.php logout.php[L]
重写cond%{REQUEST_URI}^/注销\.php$[NC]
重写规则!\。(js | ico | gif | jpg | png | css | swf | csv | html)$index.php
“logout.php”?你确定?是的,我确定我刚刚注意到它被设置为登录,我现在正在更新!好的,看起来不一样:-@vimes1984您的文件logout.php在amenber4目录中吗?我已经编辑了我的帖子,并为注销页面添加了一条规则Ok!我认为RewriteCond现在是无用的,因为我们有一个单独的logout.php规则和[L]标志,这意味着不要试图找到另一个规则,只要使用这个。