2015-05-09 163 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]