Msg#: 4548714 posted 4:48 pm on Feb 25, 2013 (gmt 0)
I run a small web host with automatic installation of Wordpress at signup. When a client signs up, Wordpress is automatically installed using a script running after CPanel has created the user.
All the customers get their own .com/.net/.org domain at signup, however since domain propagation takes some time (and I advertise that their sites are installed within 60 seconds after signup), I need to provide a temporary URL in the meantime.
I'm using the Apache module mod_userdir for that, and it works okay, except for one thing. The resulting URLs are formatted like this: StagingDomain.com/~username. The tilde sign ( ~ ) is the problem.
It confuses both the customers (who often don't know how to type the ~ sign) and Wordpress. In order for Wordpress to work properly I have to resort to some stupid hacks/workarounds that must be uninstalled when the domain propagation is done and the site is ready for the domain.
It would be great to be able to provide the customers with their own subdomain instead.
The right way to do this would, as far as I have understood, be to use mod_vhost_alias [httpd.apache.org] to map virtual subdomains to the mod_userdir folders.
However, I simply can't wrap my head around how to do it. I've tried a lot of things, but there are simply too many different factors in play that I don't understand sufficiently to get it to work.
CustomerDomain.com - the domain the customer registered at signup and that will be used after domain has propagated StagingDomain.com - a domain I own. I want the Linux username of the customer, currently used in the "~username", to be a subdomain to the domain
The files are loaded/executed from /home/customeruser/public_html/
Msg#: 4548714 posted 12:20 am on Feb 26, 2013 (gmt 0)
welcome to WebmasterWorld, kristofferR!
you could configure your DNS and web server for wildcard subdomains and use mod_rewrite directives for doing an external redirect from subdirectories to subdomains and an internal rewrite from subdomains to subdirectories.
however the customer subdomains on your staging domain should probably be protected by basic HTTP authentication to avoid public access to staged content and non-canonical url-related issues.