【发布时间】:2016-04-27 06:35:38
【问题描述】:
所以,我最近在子域中安装了 codeigniter,当我尝试访问它时收到 500 错误。脚本应该可以正常运行,我在其他几个域上都有它,我猜它是主域文件夹 (public_html) 上的 htaccess。
这是“根”文件夹中的 .htaccess
#OLD
RewriteCond %{HTTP_HOST} ^domain.tv$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.tv$
RewriteCond %{HTTP_HOST} !^db\.domain\.com$ [NC]
RewriteRule ^/?$ http://domain.com/blog/topics/vidcast/ [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^blog/index.php/archives/category/podcast/feed$ http://feeds.feedburner.com/domainPodcast [R=301,L]
#RewriteCond %{HTTP_HOST} !^(www|ftp|webmail)\.milaraki\.com
#RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com
#RewriteRule (.*) http://domain.com/blog/wp-content/uploads/%1/$1 [L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
这是子域中的 .htaccess(命名为:db.domain.com)
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([a-z0-9_-]+)\.html$ index.php/page/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|asset|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
现在,每当我尝试访问“http://db.domain.com”时,它都会将我重定向到“http://db.domain.com/blog/”。如果我尝试通过子文件夹访问 比如 "http://domain.com/db" 它给了我一个 500Error。
我们还在 apache/error_log 中获得了这些垃圾邮件:
warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
另外,让我告诉你它在 VPS 和“根” .htaccess 文件中,它不是我制作的,而是来自客户端,我所做的只是在他的 .htaccess 文件中添加一个额外的行到“停止”重定向,但它根本不起作用。 那是我添加的行(已经在我发布的代码中)
RewriteCond %{HTTP_HOST} !^db.domain.com$ [NC]
即使我将其删除或将其留在那里,它仍然会给出错误。
哦,在“根”文件夹中,他安装了 WordPress。
希望我已经足够清楚了,请随时问我其他问题。
【问题讨论】:
-
删除 RewriteBase /blog/ 上的 RewriteEngine 并尝试
-
@DevidasKadam 好吧,我完全注释掉了那部分
<IfModule mod_rewrite.c>....</IfModule>看起来它有效,虽然现在我需要将index.php添加到 url,在我的其他域中,我从来不需要使用它...在config.php我设置了$config['index_page'] = ''; -
不用设置
$config['index_page'] ;留空 -
@DevidasKadam 我已将其设置为空白。尽管如此,每当我手动输入它时,我都会得到脚本的登录页面,但我根本不想使用
index.php。 -
你知道博客文件夹是直接指向子域的,你不需要在public_html中保留.htaccess。在博客文件夹中保留一个普通的 .thacces 文件以删除 index.php
标签: .htaccess codeigniter mod-rewrite subdomain http-status-code-500