htaccess allow and deny with Cloudflare

Locked
prune
Posts: 85
Joined: Thu 14. Nov 2019, 11:22

htaccess allow and deny with Cloudflare

Post 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...
prune
Posts: 85
Joined: Thu 14. Nov 2019, 11:22

Re: htaccess allow and deny with Cloudflare

Post 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
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: htaccess allow and deny with Cloudflare

Post 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/
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Locked