Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
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.