R
R
Roman Chugunov2018-04-10 12:54:17
Apache HTTP Server
Roman Chugunov, 2018-04-10 12:54:17

How to allow access by ip in apache2?

Hello.
There is a LAN with a server. Apache 2.2 is running on the server.
Problem: you need to deny (or redirect) everyone access to the test folder in the root of the site, except for 1 ip from the local network.
I create an htaccess file in the test folder and write there:

Order Deny,Allow
Deny from all
Allow from <ip_адрес>

Does not work. 403 for everyone without exception.
Tried to set up a redirect:
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !<ip_адрес>
RewriteRule /test http://адрес/ [R=301,L]

Doesn't work either. It just doesn't redirect.
Climbed a lot of sites, tried different versions of these two pieces of rules. So far, no results have been achieved.
Help me deal with this game :(
PS, just a redirect works Redirect 301 /test http://address/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-04-10
@shambler81

<VirtualHost 138.201.128.234:80>
/etc/apache2/site-enabled
or
/etc/httpd
In this case, they will not get into this host virtual at all and will be redirected to the default
/var/www or whatever you have installed there as garbage

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question