logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Domain Catchall
Author
NickParra



Joined: 28 Oct 2016
Posts: 1

PostPosted: Sat 29 Oct '16 5:08    Post subject: Domain Catchall Reply with quote

Basically, I have two different domains for my clients; let's call them a.com and b.com.
I have a few subdomains for each of these domains already.
What I want to do is have a different catchall for each domain, so if someone types a subdomain that doesn't exist, it goes to the domain itself.

Example:
subdomainThatDoesn'tExist.a.com should redirect to a.com. subdomainThatDoesn'tExist.b.com should redirect to b.com.

The way I have it set up now works, but only for a.com since it's listed first in my 000-default.conf file.
If I go to a subdomain that doesn't exist on b.com, it redirects to my a.com catchall

How can I get both of these working together?

Below is my 000-default.conf.

Code:

# a.com #

<VirtualHost *:80>
    ServerName a.com
    ServerAlias www.a.com
    Redirect 301 / http://a.com
    ServerAdmin admin@a.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


# b.com #

<VirtualHost *:80>
    ServerName b.com
    ServerAlias www.b.com
    Redirect 301 / http://b.com
    ServerAdmin admin@b.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Sat 12 Nov '16 22:37    Post subject: Reply with quote

You can have a <VirtualHost __default__:80> vhost
Back to top


Reply to topic   Topic: Domain Catchall View previous topic :: View next topic
Post new topic   Forum Index -> Apache