Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

automatic sub domain creation

  • 22-08-2008 09:03PM
    #1
    Registered Users, Registered Users 2 Posts: 648 ✭✭✭


    hi

    im working on a php site - i want to be able to create subdomains easily from my php script so as they redirect to pages on my site

    eg

    one.domain.com -> index.php?user=one
    john.domain.com -> index.php?user=john


    anyone know how to do this?

    many thanks


Comments

  • Registered Users, Registered Users 2 Posts: 3,890 ✭✭✭cgarvey


    Use wildchar/wildcard DNS ( I.e. *.domain.com > 1.2.3.4 ) and either use the host request header in your PHP scripts to see what was domain accessed, or use mod_rewrite in a .htaccess to do a redirect.

    Your domain host/registrar/reseller will need to support wildchar/wildcard DNS records (and most big ones do). If not you can move your DNS to a more capable provider (and still use your current host, if you like).

    Your host will also need to have support for the wildchar/wildcard sub-domain in their web server config (or maybe a fixed IP address would be an alternative, even if it does cost a bit more).


Advertisement