【问题标题】:VHost & htaccess - 500 Internal Server errorVHost & htaccess - 500 内部服务器错误
【发布时间】:2012-09-06 10:48:05
【问题描述】:

我使用 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,所以感谢您的帮助。

【问题讨论】:

    标签: php linux apache .htaccess codeigniter


    【解决方案1】:
    # 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

    【讨论】:

      猜你喜欢
      • 2016-09-22
      • 2017-04-05
      • 1970-01-01
      • 2013-02-06
      • 2015-06-28
      • 2016-04-20
      • 2014-01-01
      • 2018-05-10
      相关资源
      最近更新 更多