M
M
MaxxZ2019-12-24 07:36:46
Apache HTTP Server
MaxxZ, 2019-12-24 07:36:46

How to deny access to any Alias ​​located in the server's shared configuration?

There are multiple VirtualHosts on the same server. Alias ​​are set in the global server configuration. For example for phpMyAdmin or "Alias ​​/temp /usr/share/docs". For most servers, this is normal.
But there is one VirtualHost stub in which the work of redirects is undesirable.
Using the RewriteEngine at the root of this stub:

RewriteEngine On
RewriteCond %{REQUEST_URI} !/index.txt$
RewriteRule $ /index.txt [L,R=301]

did not lead to the expected result. Everything is blocked, except for /temp, where Alias ​​conscientiously processes.
Is it possible to disable calling aliases at the htaccess level without touching the global config?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2019-12-24
@shambler81

Add a redirect to phpmyadmin config
/etc/apace2/conf-enabled/phpmyadmin.conf

RewriteEngine on
 RewriteCond %{HTTP_HOST}   ^(www\.|)domain\.ru$ [NC]
  RewriteRule   ^/(.*)$ https://domain.ru/404.html/$1  [R=301,L]

But it would be more correct to add phpmyadmin to the config generator for each site
and disable it for a specific one
, but you need to look at what kind of implementation you have.

M
MaxxxZ, 2019-12-24
@MaxxxZ

As an option. But I apparently put it wrong, how can you ignore any Alias ​​set in the global config? Not knowing their names. If it is possible of course.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question