2015-05-09 165 views
1

我在网上搜索了这个,发现了很多解决方案,但都没有工作。忽略RewriteRule中的目录 - .htaccess

我使用共享主机,并在此托管所有的网站数据在一个public_html文件夹。

我在public_html文件夹中有一个名为“mainexample.com”的主站点的.htaccess文件,并且所有其他网站都有根据其域名命名的文件夹。例如“example1.com”和“example2.com”。

我只想忽略这些“example1.com”和“example2.com”文件夹。

以下是我的.htaccess代码。

<IfModule mod_rewrite.c> 

# index file can be index.php, home.php, default.php etc. 
DirectoryIndex index.php 

# Rewrite engine 
RewriteEngine On 

RewriteCond %{HTTPS} !=on 
RewriteRule .* https://www.mainexample.com%{REQUEST_URI} [R,L] 

# condition with escaping special chars 
RewriteBase/

RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA] 

</IfModule> 

<IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
</IfModule> 
+0

忽略如何为了什么?发生什么事情,你想忽略他们? –

+0

@PanamaJack我不想将我的重写规则应用于特定的文件夹。它被命名为“example1.com”和“example2.com”。 – Hodor

回答

0

插入略低于RewriteEngine On行此规则,以忽略所选文件夹:

RewriteRule ^(example1|example2)\.com(/|$) - [L,NC]