Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 15363 invoked from network); 22 Dec 2008 18:34:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Dec 2008 18:34:26 -0000 Received: (qmail 2587 invoked by uid 500); 22 Dec 2008 18:34:15 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 2572 invoked by uid 500); 22 Dec 2008 18:34:15 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 2555 invoked by uid 99); 22 Dec 2008 18:34:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Dec 2008 10:34:15 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ivan.ivanov.zanev@gmail.com designates 209.85.219.23 as permitted sender) Received: from [209.85.219.23] (HELO mail-ew0-f23.google.com) (209.85.219.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Dec 2008 18:34:04 +0000 Received: by ewy4 with SMTP id 4so1098637ewy.0 for ; Mon, 22 Dec 2008 10:33:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=V4NPC+RCVtcRvnDizHbptC5DOfo938ynNkfjtM2rtM4=; b=YeCcj684bgYTScPcyZZIuO6qjCjupUX4AqICbabPV/kpFG+mkFZOleim9od+nw1wJf z0pIffoJDDrDpgYtvH8H+QFlKBAR3PNnuPltwzTOjEEBRRFbXS5qlOSv71INhD/TIbEZ X3mnMJxZVwxi1IJB1x6cOs8fQp0sDHnzhTM5c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=GbDxTLcy8C9J6YYn0HYtjtED1asczhNYmBYT7j2l9fT640H4QcyHlKkq2OWV6livrU DYpInKZ+RLY53gM+bx8V+Qiut9IUWJpPCRpZJZ4n05Cz+FUI5/giirYNGhcQIicUmEN3 VU1oB4ZBIYO3GN9ZVgHHC1eohpC4dYArIjYCM= Received: by 10.210.20.17 with SMTP id 17mr7713113ebt.37.1229970821974; Mon, 22 Dec 2008 10:33:41 -0800 (PST) Received: by 10.210.112.7 with HTTP; Mon, 22 Dec 2008 10:33:41 -0800 (PST) Message-ID: <68929cf00812221033p1fb899c0w845125fd6df7c8f4@mail.gmail.com> Date: Mon, 22 Dec 2008 20:33:41 +0200 From: "Ivan Zanev" To: users@httpd.apache.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_85654_9536260.1229970821972" X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] Subdomains Hosting Continuation ------=_Part_85654_9536260.1229970821972 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 thehost.com. That is: x.thehost.com We access x.thehost.com: Everything works fine and index.html opens. We access x.thehost.com/images: 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 x.thehost.com/images: 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 x.thehost.com (as it is the parent of x.thehost.com/images), we end up in x.thehost.com/files/sdsymlinks/x. Now let me walk you through my .htaccess file: 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 x.thehost.com(the 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 x.thehost.com/something (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! ------=_Part_85654_9536260.1229970821972 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 thehost.com. That is: x.thehost.com

We access x.thehost.com: Everything works fine and index.html opens.

We access x.thehost.com/images: 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 x.thehost.com/images: 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 x.thehost.com (as it is the parent of x.thehost.com/images), we end up in x.thehost.com/files/sdsymlinks/x. 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]
</IfModule>

The first pair of conditions check if we are trying to access x.thehost.com (the 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 x.thehost.com/something (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!
------=_Part_85654_9536260.1229970821972--