我使用 ISPConfig 3 来管理我的域/子域。
我添加了子域 parim.kristian.ee
,它将重定向到 web/parim/
(注意:web/ 是我的文档根)。
ISPConfig 生成了到 apache 配置的重定向:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^parim.kristian.ee [NC]
RewriteRule ^/(.*)$ /parim/$1 [L]
现在,如果我尝试获取静态资源,例如 http://parim.kristian.ee/images/1x1.gif ,它可以正常工作,但是当重定向到 codeigniter 时,它不起作用。
web/parim/
中的 Htaccess 如下所示:
<IfModule mod_rewrite.c>
RewriteEngine on
Options -Indexes
#Handle CodeIgniter request
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 ./index.php
</IfModule>
注意:通过 http://kristian.ee/parim/ 访问同一文件夹有效!
我很讨厌 htaccess,所以非常感谢您的帮助。
最佳答案
# To remove index.php from URL
RewriteEngine On
RewriteBase /parim
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
或者简单删除 RewriteBase/parim
关于php - VHost 和 htaccess - 500 内部服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12404721/