[pmwiki-users] cleanURLand subdomain config.

Patrick R. Michaud pmichaud at pobox.com
Tue Apr 19 00:49:43 CDT 2005


On Tue, Apr 19, 2005 at 02:12:28AM -0300, jack marting wrote:
> PROBLEM:
> My host has told me that it is possible to have unlimited subdomains
> under my domain name but they will not tell me how to do it. But they
> did give me a hint quote "Technical information on how to do this is
> beyond our
> support, but as a good guide initial step is to add *.youdomain.com in
> your DNS configuration, then use mod-rewrite in a .htaccess file."

Ick!  That doesn't sound like very good support.  But let's see if
we can point you in something of the right direction.

> QUESTIONS:
> 1--My DNS configuration has several categories (A,NS,CNAME,STR,MX,
> etc.). Which category should I put this "*.youdomain.com" into, or
> should I put it into all of them?

I'm assuming that you have only one IP address at your disposal,
so you should use one of either A or CNAME.  I'd suggest CNAME, and
have it point to the name you normally use for your domain.

> 2--Do they actually mean "*.youdomain.com" or do they mean
> "subdomain1.youdomain.com" then "subdomain2.youdomain.com" (etc.)?

While wildcard DNS names are available, they sometimes cause more
trouble thean they are worth.  I suggest creating the individual
subdomain names, as in "sub1.youdomain.com", "sub2.youdomain.com", etc.

> 3--File structure, should the subdomain be a subfolder of the domain
> folder or could it be a main folder on the same level as the domain
> (htdocs)?

It will probably need to be a subfolder of your htdocs in order for
mod_rewrite to have any chance of making it work.

> 4--Which .htaccess file in which folder should the code be placed?

It should go in your top-level htdocs folder.

> 5-The code, currently my .htaccess file contains only "Directoryindex
> pmwiki.php". Should it be before or after this line?

It won't matter if it's before or after the line.

> 6--What code, I have searched the web and found only one example of
> mod_rewrite used in a .htaccess file that was clear enough for me to
> understand. But I have been unsuccessful in getting it to work on the
> WAMP setup on my Windowsbox.

I've never tried this myself, but I'm guessing it will be
something like:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^subdomain1.*
    RewriteRule ^(.*) /subdomain1.youdomain.com$1

    RewriteCond %{HTTP_HOST} ^subdomain2.*
    RewriteRule ^(.*) /subdomain2.youdomain.com$1

I -think- this will cause requests to subdomain1.youdomain.com to
be rewritten as /subdomain1.youdomain.com/... , which would access
files in the subdomain1.youdomain.com/ directory in your htdocs/
directory.  But again, I've never tried this myself.

> 7--And finally, I have not been able to make the Clean URLs work either.

Well, I'd say to start with this first and then move on to CleanUrls.  :-)


> The subdomain problem must be a common occurrance.  Can anyone direct
> me to a good tutorial or help me with the above questions? 

It is a common occurrence but it's usually handled for you by the
hosting service (and I've generally seen it done using virtual hosts
instead of mod_rewrite).  So, it's understandable that you might
not find many guides for non-admins about how to do this.

Anyway, hope this helps.

Pm



More information about the pmwiki-users mailing list