简体   繁体   English

初学者.htaccess问题(与Codeigniter相关)

[英]Beginner .htaccess question (codeigniter related)

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: 我第一次为网站的桌面版本设置了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]

The problem is, I have a mobile version of the website located at m.domain.com - which pulls its content from domain.com/m. 问题是,我在m.domain.com上拥有该网站的移动版本-该网站从domain.com/m中提取了其内容。 When AllowOverride was 'None', this worked perfectly. 当AllowOverride为“ None”时,这可以完美地工作。 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. 现在,将其更改为“全部”并实现了上述.htaccess文件-子域不再起作用,并且显示了“ Apache服务器的测试页” html文件。

Anyone have any idea what could be causing the problem?! 任何人都不知道是什么原因引起的吗? Thanks! 谢谢!

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 ? 当您将一个htaccess文件嵌入到vhost conf中并返回AllowOverride None时,为什么一切都只允许一个htaccess文件呢?

On a side note AllowOverride All is something you usually try no do to. 附带说明,AllowOverride All是您通常不尝试执行的操作。

Example : 范例:

<VirtualHost *:80>
    ServerAlias yourdomain.com
    DocumentRoot /var/www/
        <Directory "/var/www/folder">
                RewriteEngine On
                RewriteRule XXXXXX
        </Directory>
        <Directory "/var/www/another">
                RewriteEngine On
                RewriteRule XXXXXX
        </Directory>
</VirtualHost>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM