Results 1 to 7 of 7

Thread: CNAME & PHP

  1. #1
    Join Date
    Nov 2007
    Posts
    38

    CNAME & PHP

    I've got a system where I need customers to do something like set a CNAME on a subdomain, e.g. site.domain.com, which forwards to output.mydomain.com. The site it refers to needs to output specific data based on the originating domain.

    Can PHP's HTTP_REFERER be used reliably? I heard that this could possibly not be the case as it's browser dependent... So what should be used?

    Would it be better to attempt to implement a system using wildcards and htaccess, where the client is directed to point their site.domain.com website at customer.output.mydomain.com?

    Thanks for any input

  2. #2
    Join Date
    Apr 2005
    Location
    Cochin
    Posts
    2,446
    My vote for htaccess and rewrite rules
    Sam
    Supportlobby.com - Expertise in Windows/Linux server support, IaaS and PaaS Management
    Spiralbean.com - Custom Software Development
    Email: exec @ activelobby.net | Skype: unni_active

  3. #3
    Join Date
    Mar 2005
    Location
    Athens, Greece
    Posts
    1,528
    Is there a need to redirect visitors to your domain ?

    Using site.domain.com the pages are served from your server, so the PHP var $_SERVER['SERVER_NAME'] will have the value "site.domain.com" and you can present data for that site.
    Antonis Adamakos @ FuzzFree :: Fully Managed Web Hosting, Development, Online Marketing

  4. #4
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    3,100
    what tonyFF said.

    Add site.domain.com to list of server aliases in apache configuration

    ServerName output.mydomain.co
    ServerAlias site.domain.com, site2.domain2.com, site3.domain3.com ...

  5. #5
    Join Date
    Dec 2003
    Location
    St. Louis MO
    Posts
    76
    Quote Originally Posted by sasha View Post
    what tonyFF said.

    Add site.domain.com to list of server aliases in apache configuration

    ServerName output.mydomain.co
    ServerAlias site.domain.com, site2.domain2.com, site3.domain3.com ...
    And create a CName entry. This method is used quite often and it's reliability is based on DNS only, not rewriting or browsers.
    UD Network Solutions
    http://udns.us

  6. #6
    Join Date
    Nov 2006
    Location
    College Station, TX
    Posts
    185
    If you need to create CNAMEs dynamically, look at PowerDNS. Free MySQL-based DNS -- works pretty darned well.

  7. #7
    Join Date
    Mar 2005
    Location
    Athens, Greece
    Posts
    1,528
    Wildcard dns would also be fine.
    Antonis Adamakos @ FuzzFree :: Fully Managed Web Hosting, Development, Online Marketing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •