Co-domains rewrite engine

Discussion in 'Installation/Configuration' started by jorizzzz, May 19, 2009.

  1. jorizzzz

    jorizzzz New Member

    Hi guys,

    i know that there are like a thousand threads about this, but i still don't get it :(

    I want to have a few co-domains that are redirected to a directory within my /web.

    For example, i've got the domain www.domain.tld and i've just created test.domain.tld in the co-domain section of that domain in ispconfig.
    Now i've created a .htaccess file in the root of my website and entered the following lines in there:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^test\.domain\.tld [NC]
    RewriteRule ^(.*)$ http://www.domain.tld/test$1 [R]

    This works. BUT, i don't want people to see the www.domain.tld/test in their address bar, i just want them to see test.domain.tld.

    Is there a way to do this?

    Thanks alot!
     
  2. Zandooy

    Zandooy New Member

    I am having a similar problem. Links on pages within the co-domain are redirecting to the master domain and its sub-folders. Co-domains with links are supposed to link to the Co-domain and its sub-folders.

    What I get:
    sub.domain.tld with a link to something.html in the same folder redirects to
    domain.tld/subdomain/something.html instead of
    sub.domain.tld/something.html

    This shouldn't work this way. What is the problem?
     
  3. trcinc1

    trcinc1 New Member HowtoForge Supporter

    co-domain

    If I understand your question corretly - Try this:

    Drop this in your Apache Directives (Optional) section (under IPS Site):

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTP_HOST} ^([^.]+)\.yourdomain.com:)80)?$
    RewriteRule (.*) /%1/$1 [L]
     
  4. jorizzzz

    jorizzzz New Member

    What should this do exactly? I've implemented it like you said and adjusted it to fit to the correct domain, but it doesn't do anything..
     
  5. Zandooy

    Zandooy New Member

    Nada

    I suppose I am saying that the redirect should show up as
    http://sub.domain.com/index.php
    instead of
    http://domain.com/subdomainfolder/index.php
    in the address bar.

    Those apache directives don't seem to change anything. I think you might have pointed me in the right direction though. I will look into how to use apache directives better and see if I can't come up with something that works.

    NEW INFORMATION:
    I just found some useful information on this problem. I tried it out and it works for me. This should help you jorizzzz because it solved my problem. http://www.howtoforge.com/forums/archive/index.php/t-12783.html


    .
     
    Last edited: May 23, 2009

Share This Page