1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

"catch-all" subdomains

Discussion in 'Plesk for Linux - 8.x and Older' started by sapphire, Apr 8, 2005.

  1. sapphire

    sapphire Guest

    0
     
    I'd like to be able to set up a virtual host so that domain.com responds not only to domain.com and www.domain.com, but anything.domain.com. I'm able to do this currently by adding the line:
    ServerAlias *.domain.com
    to the vhost.conf file in the conf folder for the virtual host, but then the regular subdomains don't work, because apache reads the main virtual host conf section before it gets to the subdomain ones. If you want subdomains to work with *.domain.com, the subdomains have to come first in the conf file.
     
  2. matt.simpson

    matt.simpson Basic Pleskian

    25
     
    Joined:
    Sep 12, 2001
    Messages:
    94
    Likes Received:
    0
    You can do this via DNS.

    *.domain.com CNAME domain.com

    ~Matt
     
  3. sapphire

    sapphire Guest

    0
     
    correct me if i'm wrong, but if i do that, then when i visit sub.domain.com it will actually redirect me to domain.com? I want to be able to write a PHP script that uses the value of the subdomain to show different content. i.e. if i visit cheese.domain.com I want to be shown info about cheese, but if i visit wine.domain.com I want to be shown info on wine.
     
  4. matt.simpson

    matt.simpson Basic Pleskian

    25
     
    Joined:
    Sep 12, 2001
    Messages:
    94
    Likes Received:
    0
    No it won't redirect them. You can then use $_SERVER["HTTP_HOST"] in your php script.

    Regards,
    Matt Simpson
     
  5. sapphire

    sapphire Guest

    0
     
    oh sorry, that actually won't fix the problem at all. The problem is that Apache won't answer to sub.domain.com unless it is specified as a ServerAlias as sub.domain.com. Right now, the DNS is set up so that *.domain.com is a CNAME to domain.com, but Apache won't serve the correct pages. I am able to correct this by manually editing the conf file and adding "ServerAlias *.domain.com". This should be an option in PLESK.
     
  6. jas8522

    jas8522 Basic Pleskian

    24
    23%
    Joined:
    Feb 3, 2005
    Messages:
    80
    Likes Received:
    0
    Location:
    Halifax, Nova Scotia Canada
    I'm lookin for a solution to this too

    Hey,

    I'm lookin for a similar solution, but I dont' need sub.subdomain.com to be different each time. Here's my predicament:

    I need the subdomains to actually go to subdoman.domain.com

    and anything else to go to the domain. So if someone types in hooligans.domain.com it just goes to domain.com assuming there is no subdomain called hooligans.

    Is there a way to do this easily accross all domains so that when my customers subdomains are typed in wrong it dosen't go back to the default page, but instead to their default page?
    Right now if someone goes to nonexistantsubdomain.custdomain.com, it'll take me to mydomain.com when I want it to go to custdomain.com

    There's kind of two questions there, but it's all straightforward. I need all subdomains to open the subdomain page, and all nonexistant subdomains to go that specific domain (not the default domain).

    Thanks,

    Jordan
     
  7. jprince

    jprince Guest

    0
     
    Hello.
    Instead of using Name Based,
    assign an IP to domain.com.
    Default the IP to domain.com, and then use the
    wildcard in DNS to point to that site.

    Doing so, removes the "Name" part, and will use
    IP only. You can then use whatever you want
    to parse..

    Cheers.
     
  8. UnrealMinds

    UnrealMinds Guest

    0
     
    I try to change the entries in the vhost.conf in the /conf of the vhost, but the new entry will be overwritten and nothing bring me the function that I need.

    I would like to get from "1234.domain.com" the value "1234" and the the website from the default htdocs of the domain.

    By now it get only a blank default website if I try anything else than www.domain.com or domain.com.

    I have the *.domain.com => IP entry in my DNS, but nothing will work.

    Where do I past the "ServerAlias *.domain.com" in?


    Thanx!
     
  9. jamesyeeoc

    jamesyeeoc Guest

    0
     
     
  10. UnrealMinds

    UnrealMinds Guest

    0
     
    It was a shared IP on my own root-server with no default-domain.

    At the registrar I make an A entry with "* A IP" at the domain.

    In Plesk I configure one virtual host and some other Domains with only a redirect to this domain.

    By the domain itself I make a "* CNAME IP" entry in the DNS-configuration.

    When I go to the /home/httpd/vhosts/domain.com/conf and edit the httpd.conf at the line "ServerAlias www.domain.com" into "ServerAlias *.domain.com" and than execute the command "/usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com" and restart the apache, there will be no changes in the httpd.conf when I open it after this procedure.

    By now I figure out, that when I try to open http://1234.domain.com, the browser show me the entry of the index.html from the path /home/httpd/vhosts/default and not from /home/httpd/vhosts/domain.com.
     
  11. Whistler

    Whistler Guest

    0
     
    Why? I can't figure what you expect from this setting? (and if I don't remember wrong - this is not even allowed - but I may be wrong).

    Are we talking about you having problems with the redirected domains or with the domain that you wish wildcard subdomains to work on?

    This is also wrong! You need to make it a *.<domain>.<tld>. IN CNAME <domain>.<tld>. (it's important to remember the . after <tld>) in the DNS configuration of the domain you want to enable wildcard subdomains.

    This will work - without having to configure anything else than DNS if you make it correct.
     
  12. UnrealMinds

    UnrealMinds Guest

    0
     
    there is only a problem with this one domain, not with the redirects. ;-)

    My entry in the DNS is as correct as you write.

    But it still doesn't work. :-(
     
  13. Whistler

    Whistler Guest

    0
     
    Whats the name of your domain?
     
  14. UnrealMinds

    UnrealMinds Guest

    0
     
  15. jamesyeeoc

    jamesyeeoc Guest

    0
     
    Your domain's nameservers are listed as:

    waterphoenix.de. NS IN 600 ns10.schlundtech.de.

    waterphoenix.de. NS IN 600 ns9.schlundtech.de.

    Did you make the DNS change:

    *.waterphoenix.de. CNAME waterphoenix.de.

    on those nameservers, or just on your Plesk DNS? Since the schlundtech.de nameservers are the ones answering requests, the changes will have to be done to the zone files on those nameservers.
     
  16. UnrealMinds

    UnrealMinds Guest

    0
     
    Well, I had a "* A IP" record for the two nameserver you told from.

    And on my plesk-system I have a "*.waterphoenix.de. CNAME waterphoenix.de." entry.

    But now I know that it wasn't functional if I make an entry in the plesk, when plesk wasn't the primary DNS-Server.

    I will try to get in contact with the support from my domainseller, because the problem is only on plesk and its still work under confixx.
     
Loading...