Page 1 of 1

htaccess allow and deny with Cloudflare

Posted: Sun 28. Mar 2021, 05:13
by prune
I created an htaccess with rule to only allow my IP to access index.php but this is not working when site is behind Cloudflare

Keyhelp does not do xforward IP by default? I think it sees the visitor IP as Cloudflare's...

Re: htaccess allow and deny with Cloudflare

Posted: Sun 28. Mar 2021, 15:03
by prune
I already tried directory protection but it seems it will protect the whole path beyond /sub/

I want protected access to

domain.com/sub

But this should be accessible without pass

domain.com/sub/?img=123.JPG

Anyway to do this via htaccess manually please?

Thanks

Re: htaccess allow and deny with Cloudflare

Posted: Mon 29. Mar 2021, 09:52
by Alexander
You have to tweak your webserver settings, in order to get the real IP.

https://www.google.com/search?q=apache+cloudflare+ip
https://devanswers.co/get-real-client-i ... pache-php/