初学者 .htaccess 问题(codeigniter 相关)
我第一次为我的网站桌面版本设置 CodeIgniter,在将 AllowOverride 从 None 更改为 All 以使以下 .htaccess 规则起作用后遇到了一些问题:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|m|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
问题是,我有一个移动版本位于 m.domain.com 的网站 - 从domain.com/m 提取其内容。当AllowOverride 为“None”时,效果非常好。现在我已将其更改为“全部”并实现了上述 .htaccess 文件 - 子域不再起作用,并且显示了“Apache 服务器的测试页”html 文件。
任何人都知道可能导致问题的原因是什么?谢谢!
I've setup CodeIgniter for my desktop version of the website for the first time, and I'm having a little problems after changing AllowOverride from None to All so that the following .htaccess rules work:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|m|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
The problem is, I have a mobile version of the website located at m.domain.com - which pulls its content from domain.com/m. When AllowOverride was 'None', this worked perfectly. Now that I've changed it to 'All' and implemented the above .htaccess file - the subdomain no longer works and I get a "Test Page for the Apache Server" html file displayed.
Anyone have any idea what could be causing the problem?! Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您可以将其嵌入到虚拟主机配置中并返回到“AllowOverride None”(似乎对您来说效果更好)时,为什么您只对一个 htaccess 文件进行“AllowOverride All”?
附带说明一下,AllowOverride All 是您通常不尝试做的事情。
例子 :
Why do you AllowOverride All for just one htaccess file when you could embed it in the vhost conf and go back to AllowOverride None where things seems to work better for you ?
On a side note AllowOverride All is something you usually try no do to.
Example :