php - VHost 和 htaccess - 500 内部服务器错误

标签 php linux apache .htaccess codeigniter

我使用 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/

相关文章:

apache没有读取更新的符号链接(symbolic link)

php - Javascript 多值调用

PHP 有条件地从数据库中减去 1

linux - Ubuntu 12.04 上带有 mod_jk 的 Tomcat 7 和 Apache2

php - 删除文件时出现权限被拒绝错误的原因是什么?

php - 如何检查是否在 php 中启用了 mod_rewrite?

apache - %(百分号)在 Apache 的 httpd.conf 中有什么作用?

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP

php - PDO 查询检查值是否存在

c++ - 如何在控制台应用程序中创建命令历史记录?