I have a page for API checker related to: https://example.com/?sts_auth I want to only the server can check this page. How can I do this by .htaccess file?
Asked
Active
Viewed 448 times
1 Answers
0
This worked for me:
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$
RewriteCond %{QUERY_STRING} ^sts_auth$ [NC]
RewriteRule ^(.*)$ - [L,F]
Replace your desired IP in the 127\.0\.0\.1
(For example, if your IP address is 123.12.1.345
, you would change it to 123\.12\.1\.345
)
The F
in [L,F]
will cause a Forbidden (403)
Error

ThePloki
- 185
- 13
-
I tested but not worked! my subpage is /?sts_auth and I want to show 403 error for other IPs. – Pouya Jun 17 '16 at 22:38
-
1