Forum Moderators: phranque
I want to offer users for my web program, their own subdomain to my site - without my setting up any subdomains - i.e. I want to redirect each 'dummy' subdomain to a particular real address.
For example:
www.yourcompany.mywebsoftware.com gets redirected to:
www.mywebsoftware.com/application2879
OR
www.yourcompany2.mywebsoftware.com gets redirected to:
www.mywebsoftware.com/application3782
Basically what I want to do is allow clients to be able to choose their subdomain name, and then all I have to do is put a new entry in my .htaccess file and it will redirect it to where I want on my server(but it will NOT be a subdomain).
Thanks for any assistance,
Understand that this kind of solution scales very poorly. Because there are no lexical similarities between the account name and the account number, you'll need to use either one rule per account, or use RewriteMap -- either for a direct table lookup, or to call a script/database to look up the related account using MySQL or similar.
You might just want to look into Apache mod_userdir -- it's a lot simpler.
Jim
Would the mod_userdir let me achieve exactly what I want - when I looked that up, the examples given didn't indicate to me that it would do what I wanted....The examples given indicated that the directory accessed could be changed, leaving the suffix of the address the same - I kinda want the reverse.
<snip>
[edited by: jdMorgan at 2:37 pm (utc) on Mar. 22, 2006]
[edit reason] Please use Commercial Exchange forum to post job offers. [/edit]
Options +FollowSymlinks
RewriteEngine On
# Once copy of the following per customer, with subdomain and paths modified to suit.
RewriteCond %{REQUEST_URI}!^/customer_files/
RewriteCond %{HTTP_HOST} ^customer_subdomain\.example\.com
RewriteRule (.*) /customer_files/$1 [L]