While editing my website I wanted to make it safer. One thought was to restrict the access of specific URLs like /admin or /login based on the IP adress.
So noone should be able to access those URLs without one of the set IP adresses.
As soon as I add the following part to my .htaccess and reload my apache2 service the whole website goes down resulting in an Internal Server Error. If I remove it everything works fine again.
# Restrict Suburl Access
<Location /admin>
Order deny,allow
Deny from all
Allow from 87.158.*.*
Allow from AnotherIP
</Location>
The rest of the .htaccess works fine:
# Remove index.php of WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# Redirect 403 to custom 404 page
ErrorDocument 403 /404
Thankful for every helpful information!