-1

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?

Pouya
  • 1
  • 1
  • probably duplicate http://stackoverflow.com/questions/4400154/deny-all-allow-only-one-ip-through-htaccess – plusz Jun 17 '16 at 22:29

1 Answers1

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