如何忽略从父目录的.htaccess文件文件、目录、htaccess

2023-09-02 01:08:37 作者:甜甜少女

我使用的是优化搜索​​引擎的URL重写规则 在我的根文件夹中,我有以下.htaccess文件:

I'm using rewrite rules for search engine optimized url's In my root folder I have the following .htaccess file:

Options +FollowSymlinks RewriteEngine On RewriteCond %{http_host} ^elitegameservers.net [NC]
RewriteRule ^(.*)$ http://www.elitegameservers.net/$1 [R=301,L]
rewriteEngine on
rewriteBase /
rewriteCond %{HTTP_HOST} ^(.*)haloservers(.nl|.us|.net)$
rewriteRule ^(.*) http://www.haloservers.net/$1 [L,R=301]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?haloservers(.nl|.us|.net) [NC]
RewriteRule ^(.*).html$ http://www.elitegameservers.net/$1 [R=301,L]

在子目录(/ ControlPanel控制)我运行WHMCS用下面的.htaccess文件:

In the sub directory(/controlpanel) I run WHMCS with the following .htaccess file:

RewriteEngine On
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^elitegameservers.net [NC]
RewriteRule ^(.*)$ http://www.elitegameservers.net/controlpanel/$1 [R=301,L] 

RewriteEngine On

# Announcements
RewriteRule ^announcements/([0-9]+)/[a-z0-9_-]+.html$ ./announcements.php?id=$1 [L,NC]
RewriteRule ^announcements$ ./announcements.php [L,NC]

# Downloads
RewriteRule ^downloads/([0-9]+)/([^/]*)$ ./downloads.php?action=displaycat&catid=$1 [L,NC]
RewriteRule ^downloads$ ./downloads.php [L,NC]

# Knowledgebase
RewriteRule ^knowledgebase/([0-9]+)/[a-z0-9_-]+.html$ ./knowledgebase.php?action=displayarticle&id=$1 [L,NC]
RewriteRule ^knowledgebase/([0-9]+)/([^/]*)$ ./knowledgebase.php?action=displaycat&catid=$1 [L,NC]
RewriteRule ^knowledgebase$ ./knowledgebase.php [L,NC]

我注意到,在WHMCS知识渊博的SEO优化似乎并没有正常工作,它似乎由的.htaccess code。在我的根目录造成的。

I noticed that knowledgeable SEO optimization in WHMCS doesn't seem to work properly and it seems to be caused by the .htaccess code in my root directory.

这一点,因为我不想被排除在code的根目录的ControlPanel子目录。

Because of that I want the controlpanel sub directory to be excluded from the code in the root directory.

感谢您的帮助

推荐答案

您可以尝试增加一个条件,在根目录下的规则来排除开始 ControlPanel控制请求:

You could try adding a condition to the rules in your root directory to exclude requests starting with controlpanel:

RewriteCond %{REQUEST_URI} !^/controlpanel
rewriteCond %{HTTP_HOST} ^(.*)haloservers(.nl|.us|.net)$
rewriteRule ^(.*) http://www.haloservers.net/$1 [L,R=301]

RewriteCond %{REQUEST_URI} !^/controlpanel
RewriteCond %{HTTP_HOST} ^(www.)?haloservers(.nl|.us|.net) [NC]
RewriteRule ^(.*).html$ http://www.elitegameservers.net/$1 [R=301,L]