htaccess causing 500 internal error in litespeed but OK on apache

Discussion in 'Apache Migration/Compatibility' started by benj74, May 20, 2013.

  1. benj74

    benj74 New Member

    Hello,

    I am using a subdomain handler script from Randall Krause (http://www.webmasterworld.com/apache/3163397.htm) which has always been working 100% perfectly on apache but is causing 500 internal errors since I moved to litespeed.

    Code:
    RewriteBase /
    
    #### URL Rewrite Handler for Subdomains (by Randall Krause) ####
    
    RewriteCond %{ENV:REDIRECT_SUBDOMAIN} =""
    RewriteCond %{HTTP_HOST} ^([a-z0-9][-a-z0-9]+)\.mydomain\.org\.?(:80)?$ [NC]
    RewriteCond %{DOCUMENT_ROOT}/subdomains/%1 -d
    RewriteRule ^(.*) subdomains/%1/$1 [E=SUBDOMAIN:%1,L]
    RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]
    
    I don't understand what can cause the internal errors but there must be a syntax "misunderstood" by litespeed or handled differently on litespeed.

    Any idea as to what could be the cause of this problem ?

    Thanks a lot,

    Cheers,
  2. mistwang

    mistwang LiteSpeed Staff

    Looks like %{ENV:REDIRECT_SUBDOMAIN} is not set, as it is not a standard environment variable. Just try the simplified rule.

    RewriteCond %{ENV:SUBDOMAIN} =""
    RewriteCond %{HTTP_HOST} ^([a-z0-9][-a-z0-9]+)\.silverwayve\.com\.?:)80)?$ [NC]
    RewriteCond %{DOCUMENT_ROOT}/subdomains/%1 -d
    RewriteRule ^(.*) subdomains/%1/$1 [E=SUBDOMAIN:%1,L]

Share This Page