Apache .htaccess仅适用于root,而我需要它跨域名工作

Apache .htaccess仅适用于root,而我需要它跨域名工作,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我有以下重写规则 RewriteCond %{REQUEST_URI} !/maintenance.php$ [NC] RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC] RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC] RewriteCond %{REMOTE_ADDR} !{developer_ip} RewriteRule .* /maintenance.php [R=302

我有以下
重写
规则

 RewriteCond %{REQUEST_URI} !/maintenance.php$ [NC]
 RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
 RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
 RewriteCond %{REMOTE_ADDR} !{developer_ip}
 RewriteRule .* /maintenance.php [R=302,L]
这个.htaccess应该将所有请求重定向到
maintenance.php
,来自
{developer\u ip}
的请求除外,后者是我自己的ip地址

问题:

上面的规则是有效的,但当我点击任何内部链接时,它再次显示maintenance.php(由于IP规则,它不能出现),它以
index.php?{some_query}
或一个也已经被.htaccess本身重写的URL结尾,例如
/Page/About US
(原来是
index.php?page_id=200


现在我希望
.htaccess
将所有请求重定向到maintenace.php(已经在这样做了),但是没有来自
{developer\u ip}的请求
。除了不包括我自己的ip地址的部分,上面的规则是可以的,该部分将我重定向到内部链接。

执行对维护页面的内部重写,并按以下顺序保留规则:

RewriteEngine On

RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif)$ [NC]
RewriteCond %{REMOTE_ADDR} !{developer_ip}
RewriteRule !^maintenance\.php$ /maintenance.php [NC,L]

# skip any requests alredy rewritten to maintenance.php
RewriteRule ^maintenance\.php$ - [NC,L]

# rest of your rewrite rules

打开日志记录并观察它的功能