2013-05-07 46 views
3

我一直在嘗試在worpress文件夾內運行codeigniter。目前的htaccess是在url重寫類似域/年/月的模式。在wordpress內放置codeigniter文件夾

有沒有一種方法,以防止一個URL中使用的.htaccess

當前使用的WordPress htaccess的代碼重寫了paticular文件夾,如下:

AddOutputFilterByType DEFLATE text/html text/plain text/xml 

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 



# BEGIN WPSuperCache 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
AddDefaultCharset UTF-8 
RewriteCond %{REQUEST_METHOD} !POST 
RewriteCond %{QUERY_STRING} !.*=.* 
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$ 
RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* 
RewriteCond %{HTTP:Accept-Encoding} gzip 
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f 
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L] 

RewriteCond %{REQUEST_METHOD} !POST 
RewriteCond %{QUERY_STRING} !.*=.* 
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$ 
RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* 
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f 
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L] 
</IfModule> 
# END WPSuperCache 


Options +Includes +ExecCGI 
AddHandler cgi-script .cgi .pl 
AddType text/html .shtml 
AddHandler server-parsed .shtml 
AddType text/html .html 
AddHandler server-parsed .html 
AddType text/html .htm 
AddHandler server-parsed .htm 
options -Indexes 

DirectoryIndex index.htm index.html.var index.htm index.php 
AddType text/html .shtml 
AddHandler server-parsed .shtml 
AddType text/html .html 
AddHandler server-parsed .html 
AddType text/html .htm 
AddHandler server-parsed .htm 
options -Indexes 

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

回答

2
RewriteCond $1 !^(myFolder|otherFolder) 

將增加一個條件檢查以下不存在。因此在本例中,myFolderotherFolder將不會被重寫。

您可以通過追加管道|和文件夾名稱來添加其他文件夾。您也可以忽略文件名,但您需要避開例如index\.html

你應該能夠每個WP的前添加此條件RewriteRule s到禁用WP改寫爲您的CI文件夾:

RewriteCond $1 !^(myCodeIgniterFolder) 
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L] 

或者,你可以在WP的頂部添加此.htacess

RewriteCond %{REQUEST_URI} ^/mycodeigniterfolder [NC] 
RewriteRule .* - [L]