Mod rewrite HttAccess ModRewrite用于具有已驻车/重定向域的CodeIgniter

Mod rewrite HttAccess ModRewrite用于具有已驻车/重定向域的CodeIgniter,mod-rewrite,codeigniter,Mod Rewrite,Codeigniter,我有这样的情况: 主机位于maindomain.com othersite.com已停在maindomain.com上 htaccess用于将对othersite.com的所有请求重定向到子文件夹:/site othersite/ 我想在othersite.com上使用CodeIgniter,但othersite.com中有一些目录和文件,我不想使用CodeIgniter重定向。 php是我的CodeIgniter主页。 我曾尝试将我在停靠域中使用的常规ModRewrite与我在CodeIgni

我有这样的情况:

主机位于maindomain.com othersite.com已停在maindomain.com上 htaccess用于将对othersite.com的所有请求重定向到子文件夹:/site othersite/ 我想在othersite.com上使用CodeIgniter,但othersite.com中有一些目录和文件,我不想使用CodeIgniter重定向。 php是我的CodeIgniter主页。 我曾尝试将我在停靠域中使用的常规ModRewrite与我在CodeIgniter wiki中找到的内容结合起来,但遇到了麻烦

例如: 我不想让CodeIgniter处理othersite.com/demo/或othersite.com/robots.txt。我有这个:

# Redirect various urls to subfolders of the format: /site-thename/

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?othersite\.com
RewriteCond %{REQUEST_URI} !^/site-othersite/
RewriteCond %{REQUEST_URI} !^/demo/
RewriteCond %{REQUEST_URI} !^robots\.txt

Rewriterule ^(.*)$ /site-othersite/home.php?/$1 [L]
CodeIgniter安装时一切正常。除了试图让demo/and robots.txt“离开”CodeIgniter之外,其他方法都不起作用


还有那些有建议的重写大师?谢谢大家!

找到了答案。需要按照两条规则处理:

# Redirect various urls to subfolders of the format: /site-thename/

RewriteEngine On

# Handle pages and directories that should not go through CodeIgniter.
RewriteCond %{HTTP_HOST} ^(www\.)?othersite\.com
RewriteCond %{REQUEST_URI} !^/site-othersite/
RewriteCond %{REQUEST_URI} ^/demo/ [OR]
RewriteCond %{REQUEST_URI} ^/robots.txt

Rewriterule ^(.*)$ /site-othersite/$1 [L]


# Handle CodeIgniter URLs.
RewriteCond %{HTTP_HOST} ^(www\.)?othersite\.com
RewriteCond %{REQUEST_URI} !^/site-othersite/

Rewriterule ^(.*)$ /site-othersite/home.php?/$1 [L]

我想我的困惑在于理解重写条件行是如何工作的。要执行规则,它们是否都必须为真?另外,如何格式化最后2个条件中的异常。第二个条件是防止重定向循环所必需的。