Subdomains with .htaccess rewrite rules not working

Discussion in 'General' started by acamino, May 6, 2010.

  1. acamino

    acamino New Member

    Hey, i have a little problem.. i set a subdomain well:

    subdomain.domain.ltd

    it's work fine, but the problem is when i put an .htaccess file inside with a rewrite rule, for example:

    RewriteEngine on

    makes this:

    domain.tld/path_to_subdomain -> Works well! :)

    subdomain.domain.tld -> .htaccess error!! :(

    Here was my config (added by ISPConfig):
    /etc/httpd/conf/sites-available/domain.ltd.vhost
    Code:
        RewriteEngine on
        RewriteCond %{HTTP_HOST}   ^subdomain.domain.ltd [NC]
        RewriteRule   ^/(.*)$ /var/www/clients/client0/web2/web/path_to_subdomain/$1  [L]

    /var/www/clients/client0/web2/web/path_to_subdomain/.htaccess

    Code:
    RewriteEngine on
    RewriteRule ^(.*)$ index.php [QSA,L]

    domain.tld/path_to_subdomain -> Works well! :)

    subdomain.domain.tld -> .htaccess error!! :(

    it's very rare, i don't know what to do.. i tried lot of things
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The problem is that you use a rewrite rule to point the subdomain to a subdirectory and then use another rewrite rule in thet subdirectory. Instead of redirecting the subdoamin to a subdirectory, remove the subdomain and create a new website instead with "subdomain.domain.ltd" in the domain field.
     
  3. acamino

    acamino New Member

    mmmm

    here is my ugly solution:

    Code:
        RewriteEngine on
        RewriteCond %{HTTP_HOST}   ^subdomain.domain.ltd [NC]
    RewriteRule   ^/(.*)$ /var/www/clients/client0/web2/web/path_to_subdomain/index.php/$1  [L]
    Adding the index.php works fine
     

Share This Page