Special access rule in an .htaccess file for IP addresses, authorized only for one directory structure

47 views Asked by At

I have been dealing with WordPress for many years, but have a delicate problem with an access rule that I want to store in .htaccess. I use actually Apache 2.4.56.

  • Initial situation 1: The web server should only be accessible from the outside for certain users.
  • Initial situation 2: I have two given IP addresses.

The first client IP address should be able to fully access the web server, therefore:

require ip 192.168.124.1

Now I have a second client IP address that should also be allowed to access the web server, but only to a specific directory structure called /foo. This access rule should apply to /foo, but also to everything below it, e.g. /foo/bar. There should explicitly be no redirection within the shared folder structure, i.e. if someone wants to access /foo/bar, then they should also be allowed to access /foo/bar.

Since I use WordPress, the directory structure is only virtual, so I cannot store my own .htaccess files in the subdirectory structure.

Regards, Besim

0

There are 0 answers