I uploaded an html 403 and 404 page to my WordPress theme directory and if I hit a random mistake after .com such as .com/yyyy then it loads the 404 page for example - so all is good...
However...I would like the 403.php to be shown when someone outside my permitted IP string attempts to access my log in page.
This .htaccess rule works great BUT it create a never-ending loop as WordPress tries to find the 403.php page..
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^111\.111\.22\.33$
RewriteRule ^(.*)$ - [R=403,L]
</IfModule>
So you can see on the last line that there is R=403 which is trying to find the 403 page, but it can't find it...
I therefore added the following lines (trying one at a time) but they didnt work:
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
and then I tried
ErrorDocument 403 /index.php?error=403
ErrorDocument 404 /index.php?error=404
And no joy...
Should the 403 and 404 template have WordPress specific php at the top of the template?
Or - how can i correctly call the 403.php when the user WITHOUT the correct IP address tries to access the log in page?
Thanks!