我有这样的情况:
位于maindomain.com
我尝试将我经常使用的ModRewrite与我在CodeIgniter wiki中找到的内容结合起来,但是我遇到了麻烦。
示例:我不希望CodeIgniter处理othersite.com/demo/或thersite.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安装,一切都很好。除了试图让演示/和robots.txt成为CodeIgniter的“外部”之外,这是行不通的。
ModRewrite大师们有什么建议吗?谢谢!
发布于 2010-10-06 16:00:26
弄明白了。它需要通过两条规则来处理:
# 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]https://stackoverflow.com/questions/3873993
复制相似问题