Forum Moderators: phranque

Message Too Old, No Replies

Need help configuring index files for thousands of subdomains.

Should I use MOD_REWRITE or something else?

         

rescueme

9:42 pm on Apr 7, 2011 (gmt 0)

10+ Year Member



We are setting up custom subdomains for all of our website users. This could end up being in the tens of thousands, maybe more. Each user will get one and only page on our website, and they can view it by going to this URL:

username.OURDOMAIN.COM

We are going to setup each user's HTML file in a folder on the server, so the HTML code for each user would actually be stored some place like this:

/USERPAGES/username1.htm
/USERPAGES/username2.htm
/USERPAGES/username3.htm
etc.

When someone types in username.OURDOMAIN.COM we don't want them redirected, we want them to just see that domain in their browser, but have Apache serve up the page /USERPAGES/username.htm

Basically Apache needs to pull out the subdomain and know that the file for that user is stored somewhere, retrieve and serve it.

I'll explain what we need to do again using * for a wildcard character to make sure I'm explaining this properly:

*.OURDOMAIN.COM
would cause Apache to automatically serve this page:
/USERPAGES/*.htm

Pages will all be subdomains of the same domain on the same IP, and I can't define them all separately since there will be thousands of them. I need some sort of wildcard driven configuration to do that all automatically.

What is the simplest way to accomplish this? Do I use MOD_REWRITE or something else to do this? Would appreciate any suggestions!

Best wishes,

- Jeff

rescueme

2:38 am on Apr 8, 2011 (gmt 0)

10+ Year Member



Since posting my question, I found two pages which seem to outline good solutions. First was in another older posting in this forum here:

[webmasterworld.com...]

The other was on another website, here:

[muffinresearch.co.uk...]

If anyone has any other ideas to add, please do. In the meantime I will try what is referenced in the links above tomorrow.

Best wishes,

- Jeff