General
cancel
Showing results for 
Search instead for 
Did you mean: 

Apache - How can I limit access only to specific URLs?

Vitaly Karasik_1
Honored Contributor

Apache - How can I limit access only to specific URLs?

I have a website (virtual server) and many DNS
aliases pointed to the same server.

But I have some directory which should be accessible
only via specific DNS alias (== URL).
If/How this can be done?

E.g, I have a.example.com, b.example.com,
c.example.com pointed to the same virtualhost.
And for a.example.com I'd like to provide access to
some dir as http://a.example.com/only_for_a.
(it shouldn't be accessible as
http://b.example.com/only_for_a)
3 REPLIES
Vitaly Karasik_1
Honored Contributor

Re: Apache - How can I limit access only to specific URLs?

solved using apache variables:

SetEnvIf Host linux1.example.com allow_host_linux1


Order Deny,Allow
Deny from all
Allow from env=allow_host_linux1
Ivan Ferreira
Honored Contributor

Re: Apache - How can I limit access only to specific URLs?

Please correct me if I'm wrong, but if you specify a different DocumentRoot for each virtual host, and for example, a different directory includes in each virtual host:

Include conf.d//*.conf

The pages available to one virtual host sould not be served by another virtual host.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Vitaly Karasik_1
Honored Contributor

Re: Apache - How can I limit access only to specific URLs?

Ivan, thank you!
In my configuration I use just DNS aliases for different customers, I don't have apache virtualhost per customer.