Welcome to WebmasterWorld Guest from 54.145.144.101

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

htaccess redirect and wildcard DNS

redirecting a user generated subdomain name to a specific page

   
1:40 am on Jul 17, 2007 (gmt 0)

10+ Year Member



Hi,

I'd appreciate any advice on this :)

We're using wildcard DNS on a site and I'm wanting to redirect like so:

fred.site.com

to display the page:

[site.com...]

The username in the above example, "fred", isn't something we'll have control over - the user will select that when they sign up.

Thanks in advance!

1:47 am on Jul 17, 2007 (gmt 0)

10+ Year Member



Whoops, looks like I need to search a little better - found a stack of other posts that most likely have the answer I need. Please excuse the false alarm :).
2:12 am on Jul 17, 2007 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



If you're writing a rewrite rule to 'map' username-subdomains to directories, then you *will* have to take control over those usernames. They will have to be:

valid HTTP subdomain strings,
valid HTTP URL-strings, and
valid *nix filepath strings.

I strongly suggest that you accept *only* username strings containing lowercase letters, numbers, and hyphens, and further, that the username must start with a letter and end with a letter or a number. That will keep you out of trouble with the various protocol and filesystem requirements.

You can code the mod_rewrite accordingly, but the new-user sign-up script must enforce the "rules" above, so as not to allow creation of accounts that cannot be accessed.

Jim

[edited by: jdMorgan at 2:19 am (utc) on July 17, 2007]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month