httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Zanev" <>
Subject [users@httpd] Subdomains Hosting Continuation
Date Mon, 22 Dec 2008 18:33:41 GMT
Well, thanks for the replies, you all! Here's what i did: I've create a
sdsymlinks folder with symbolic links to the users subdomains. The htaccess
is using the symlink, but here is what happens in several cases:

Let Superman has the x subdomain at That is:

We access Everything works fine and index.html opens.

We access The images folder does not exist. Instead of
displaying the Not Found error, we end up with recursion of urls. (will
explain later).

We access The images folder exists. A list of files is
displayed with the "Up One Level" link. We click on the Up on Level link.
Instead of going into (as it is the parent of, we end up in Now
let me walk you through my .htaccess file:

<IfModule rewrite_module>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^/$
    RewriteCond %{HTTP_HOST} !^((cp\.)|(www\.)|(admin\.))
    RewriteCond %{HTTP_HOST} ^([^\.]+)\.besthost-bg\.com$
    RewriteRule (.*) files/sdsymlinks/%1/index.html [QSA,L]

    RewriteCond %{REQUEST_URI} !^/$
    RewriteCond %{REQUEST_URI} !files/sdsymlinks/
    RewriteCond %{HTTP_HOST} !^((cp\.)|(www\.)|(admin\.))
    RewriteCond %{HTTP_HOST} ^([^\.]+)\.besthost-bg\.com$
    RewriteRule (.*) files/sdsymlinks/%1/$1 [QSA,L]

    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule (.*) index.php?url=$1 [QSA,L]

The first pair of conditions check if we are trying to access REQUEST_URI is '/'). If this is the case, we will
open index.html.
The second pair of conditions check if we are trying to access (the REQUEST_URI is not '/'). We also check if the
REQUEST_URI matches files/sdsymlinks/. Now, why would I want to do that? The
answer is, if I remove this
condition, we end up with recursion.  files/sdsymlinks/x is rewritten to
files/sdsymlinks/x/files/sdsymlinks/x/ and so on, until the recursion is
internally stopped from apache.
The third pair works if the subdomain is cp or www or admin in which cases
we don't want to go to the files/sdsymlinks.

The problem is: I don't feel it right, because for every automatic
operation, I must take care myself => not found, forbidden and so on. I've
seen some hosting sites, where you can have a subdomain, no problem and
everything works fine. But I can't get it right. Please help me!

View raw message