.htaccess frustration with subdomain

Discussion in 'Apache' started by marvinzzz, Mar 25, 2011.

  1. #1
    Under the Zend Framework, I have a directory structure like this:

    Index: /domains/example.com/public_html/public/index.php

    Blog index: /domains/example.com/public_html/blog/index.php


    In my .htaccess file, shown below is the piece that points to the homepage - this works fine:

    RewriteCond %{REQUEST_URI} =""
    RewriteRule ^.*$ /public/index.php [NC,L]
    
    RewriteCond %{REQUEST_URI} !^/public/.*$
    RewriteRule ^(.*)$ /public/$1
    
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [NC,L]
    
    RewriteRule ^public/.*$ /public/index.php [NC,L]
    Code (markup):

    I have enabled a subdomain in my host admin control panel and now I want to add a blog which is accessible via: blog.example.com

    I tried adding:

    RewriteCond %{HTTP_HOST} = ^www\.example\.com$
    RewriteRule /blog/(.*) http://blog\.example\.com/$1 [L,R=301]
    
    RewriteCond %{HTTP_HOST} = ^blog\.example\.com$
    RewriteRule ^.*$ /blog/index.php [L]
    Code (markup):

    but this produces a dreaded "Internal Server Error - 500" when navigating to blog.example.com, example.com/blog and even example.com..

    I suspect that it could be a complication with the Zend Framework that's causing grief. What should I add / edit in .htaccess for blog.example.com to point correctly ?

    Please & thank you.
     
    marvinzzz, Mar 25, 2011 IP