我遇到这种情况:
我试图将我用于托管域名的常用ModRewrite与我在CodeIgniter维基中找到但我遇到麻烦的内容结合起来。
实施例: 我不希望otherite.com/demo/或othersite.com/robots.txt由CodeIgniter处理。我有这个:
# 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 /和robots.txt成为CodeIgniter的'ouside'之外不起作用。
ModRewrite掌握了哪些建议?谢谢!
答案 0 :(得分:0)
想出来。它需要在两个规则中处理:
# 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]