0
votes

I got .htaccess blocking all user-agents and only allow one's i need
to allow cloudflare to access how can i allow not using (Mozilla) this is what i got user-agent
Mozilla/5.0 (compatible; CloudFlare-AlwaysOnline/1.0; +http://www.cloudflare.com/always-online)

    RewriteEngine on
    AuthType Basic
    AuthName "private"
    AuthUserFile "/home/example/.htpasswds/public_html/exemple/passwd"
    require valid-user
    #-only allow-#
    SetEnvIf User-Agent .0011 0011
    Order deny,allow
    Deny from all
    Allow from env=0011
    #-index only open for 0011-#
    Options +Indexes
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{HTTP_USER_AGENT} !0011 [NC]
    RewriteRule . - [F]
1

1 Answers

0
votes

You can use:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !CloudFlare-AlwaysOnline [NC]
RewriteRule ^ - [F] 

But do not do that, because Cloudflare uses the name of the user's browser user-agents for all normal queries.