• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

"catch-all" subdomains

S

sapphire

Guest
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.
 
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.
 
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.
 
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
 
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.
 
Originally posted by sapphire
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.

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!
 
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.
After making any changes to the vhost.conf or vhost_ssl.conf, you need to run the following commands to update Plesk and Apache:

Code:
/usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com

service httpd restart
I would like to get from "1234.domain.com" the value "1234" and the the website from the default htdocs of the domain.
If you have the wildcard DNS entry defined, then all requests for undefined subdomain names should automatically serve up the domains' default htdoc index page
By now it get only a blank default website if I try anything else than www.domain.com or domain.com.
Was this happening even before you put any changes in the vhost.conf file? (assuming you already had the *.domain.com DNS)

I have the *.domain.com => IP entry in my DNS, but nothing will work.
I think I see the problem now. The entry should be a CNAME record:
*.domain.com. CNAME domain.com.

Is your IP shared with other domains, or just your own domain? Have you set a default domain for that IP address in Plesk?


Where do I past the "ServerAlias *.domain.com" in?
You would not need this, but in any case, it would go in the vhost.conf file just before the first RewriteCond line. The use of a wildcard serveralias can get a bit messy and maintenance intensive. I have posted about this earlier in the last 2 months while helping someone else.
 
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.
 
At the registrar I make an A entry with "* A IP" at the domain.

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).

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

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

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

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.
 
Are we talking about you having problems with the redirected domains or with the domain that you wish wildcard subdomains to work on?

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

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.

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

But it still doesn't work. :-(
 
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.
 
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.
 
Back
Top