Welcome Guest, Not a member yet? Register   Sign In
Creating a blogservice
#2

[eluser]tomcode[/eluser]
I always wondered how to do this Wink.

As far as I know, first the DNS setup must let pass all incoming sub domain requests. This I don't know how to do.

Once inside :

1. it should be possible using rewrite rules in .htaccess, see Rewrite Guide (2.0), Virtual User Hosts :
Quote:Description:
Assume that you want to provide www.username.host.domain.com for the homepage of username via just DNS A records to the same machine and without any virtualhosts on this machine.

Solution:
For HTTP/1.0 requests there is no solution, but for HTTP/1.1 requests which contain a Host: HTTP header we can use the following ruleset to rewrite http://www.username.host.com/anypath internally to /home/username/anypath:

Code:
RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^www\.[^.]+\.host\.com$
RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
RewriteRule   ^www\.([^.]+)\.host\.com(.*) /home/$1$2

2. I also found this page on apache.org, Dynamically Configured Mass Virtual Hosting, which probably contains better solutions


Messages In This Thread
Creating a blogservice - by El Forum - 08-16-2009, 04:15 PM
Creating a blogservice - by El Forum - 08-16-2009, 05:54 PM
Creating a blogservice - by El Forum - 08-17-2009, 04:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB