Search code examples
.htaccesscodeignitermod-rewritesubdomainhttp-status-code-500

Codeigniter Error 500 in subdomain


So, I recently installed codeigniter in a subdomain and I'm getting 500 error when I try to access it. Script should run normal, I had it on several other domains and my guess it's htaccess on the main domain folder (public_html).

Here's the .htaccess from the "root" folder

#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>

And here's the .htaccess in the subdomain (named: 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]

Now, whenever I try to access "http://db.domain.com", it redirects me to "http://db.domain.com/blog/". If I try to access by subfolder like "http://domain.com/db" it give's me an 500Error.

We also get these spam of lines in apache/error_log:

warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function

Also, let me tell you it's in a VPS and the "root" .htaccess file it's not made by me, but from the client, all I have done, it's to add an extra line in his .htaccess file to "stop" the redirect but it's not working at all. That's the line I added (already in the code i posted)

RewriteCond %{HTTP_HOST} !^db.domain.com$ [NC]
It still gives the error even if I remove it or leave it there. Oh and, in the "root" folder, he installed WordPress.

Hope I was clear enough, feel free to ask me other questions.


Solution

  • So, I ended up removing the lines bellow from the .htaccess file inside the "root" folder

    <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>
    

    Restarted Apache (no idea why this is necessary) and the new settings fixed everything...