SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Redirect Domain Name to dynamic subdomain

    I've been researching, trying and pulling out my hair for a week and I can't seem to find the solution to this issue and was hoping for some help.

    The short story...

    I created a CMS for my clients. In the past I had to upload any code changes to all the domains using that CMS. I have made some small changes to the code so that all my clients can be served by one instance of the CMS to lessen my work load so I can spend less time uploading changes and spend more time with my 2 baby girls.

    So far aside from a couple of little bugs that need to be ironed out, it works, however you can only reach the site by using a dynamic subdomain. I would like to be able to use the "real" domain name.

    I'm testing with my site which is jjsanders.net - if you use that address nothing happens.
    If you go to jeffsanders.publishpixel.com it works fine.

    My registration is at enom and I have the following host records set:
    • DNS is pointed to enom
    • jjsanders.net > CNAME(alias) > jeffsanders.publishpixel.com


    Another issue that I didn't think of until recently was how I would be able to serve email addresses on the "real" domain name?

    If anyone has any suggestions and/or solutions your assistance would be greatly appreciated.

    Thank you in advance.

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    jj,

    I am not aware whether anyone has figured out how to create "wildcard" subdomains so this is the story: Each subdomain is effectively another domain on the Internet. They are typically "rooted" in a subdirectory of the main domain but that is NOT required - they may be on entirely different servers with dissimilar IP addresses. Because of that, your dynamic (my "wildcard") subdomains are not possible.

    Of course, if anyone knows of a "wildcard" subdomain solution, I'd love to hear about it!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    May 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    Because of that, your dynamic (my "wildcard") subdomains are not possible.
    Perhaps I have the term wrong but I have a A record on my web server DNS for *.publishpixel.com. Jeffsanders.publishpixel.com does not exist as a "real" subdomain on the server. When someone comes to the site it checks a database of registered clients and serves the correct database for that fake subdomain.

    Here is how I did it. http://anantgarg.com/2013/06/10/buil...-from-scratch/

    As I mentioned. The wildcard subdomain works. If you try foo.publishpixel.com you will get an error message. I would just like to use a real internic domain to point to it.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    jj,

    Right you are!

    Quote Originally Posted by http://tools.ietf.org/html/rfc1034

    DOMAIN NAMES - CONCEPTS AND FACILITIES


    4.3.3. Wildcards


    In the previous algorithm, special treatment was given to RRs with owner
    names starting with the label "*". Such RRs are called wildcards.
    Wildcard RRs can be thought of as instructions for synthesizing RRs.
    When the appropriate conditions are met, the name server creates RRs
    with an owner name equal to the query name and contents taken from the
    wildcard RRs.

    This facility is most often used to create a zone which will be used to
    forward mail from the Internet to some other mail system. The general
    idea is that any name in that zone which is presented to server in a
    query will be assumed to exist, with certain properties, unless explicit
    evidence exists to the contrary. Note that the use of the term zone
    here, instead of domain, is intentional; such defaults do not propagate
    across zone boundaries, although a subzone may choose to achieve that
    appearance by setting up similar defaults.

    The contents of the wildcard RRs follows the usual rules and formats for
    RRs. The wildcards in the zone have an owner name that controls the
    query names they will match. The owner name of the wildcard RRs is of
    the form "*.<anydomain>", where <anydomain> is any domain name.
    <anydomain> should not contain other * labels, and should be in the
    authoritative data of the zone. The wildcards potentially apply to
    descendants of <anydomain>, but not to <anydomain> itself. Another way
    to look at this is that the "*" label always matches at least one whole
    label and sometimes more, but always whole labels.

    Wildcard RRs do not apply:

    - When the query is in another zone. That is, delegation cancels
    the wildcard defaults.

    - When the query name or a name between the wildcard domain and
    the query name is know to exist. For example, if a wildcard
    RR has an owner name of "*.X", and the zone also contains RRs
    attached to B.X, the wildcards would apply to queries for name
    Z.X (presuming there is no explicit information for Z.X), but
    not to B.X, A.B.X, or X.

    A * label appearing in a query name has no special effect, but can be

    used to test for wildcards in an authoritative zone; such a query is the
    only way to get a response containing RRs with an owner name with * in
    it. The result of such a query should not be cached.

    Note that the contents of the wildcard RRs are not modified when used to
    synthesize RRs.

    To illustrate the use of wildcard RRs, suppose a large company with a
    large, non-IP/TCP, network wanted to create a mail gateway. If the
    company was called X.COM, and IP/TCP capable gateway machine was called
    A.X.COM, the following RRs might be entered into the COM zone:

    X.COM MX 10 A.X.COM

    *.X.COM MX 10 A.X.COM

    A.X.COM A 1.2.3.4
    A.X.COM MX 10 A.X.COM

    *.A.X.COM MX 10 A.X.COM

    This would cause any MX query for any domain name ending in X.COM to
    return an MX RR pointing at A.X.COM. Two wildcard RRs are required
    since the effect of the wildcard at *.X.COM is inhibited in the A.X.COM
    subtree by the explicit data for A.X.COM. Note also that the explicit
    MX data at X.COM and A.X.COM is required, and that none of the RRs above
    would match a query name of XX.COM.
    From my reading of that (and a few other pages from Google-listed "A record subdomain wildcard"), I would discount the one who recommended changing the namecheap DNS pointers and simply manage your DNS records via WHM/cPanel. That should work for you to access your main domain as well as your wildcard subdomains.

    Additionally, if done via DNS records (on your production server), the A records will not impact the MX records (you'll have to duplicate the wildcard creation there if you want to have e-mail for your wildcard subdomains, too) so that part of your question would be covered, too.

    WARNING: I'm not sure how your CMS is setup to handle non-existent accounts (subdomains) so you may want to have it check for the account then redirect to a "garbage handler" if the account doesn't exist (be sure to standardize your capitalization OR build a safeguard into your query creation). This could be a problem because domain names (including subdomains) are NOT case sensitive but your database and file structure is (on 'nix systems) so mixing cases could cause a problem.

    THANK YOU for posting the wildcard subdomain information.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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