.htaccess Allow All from Specific User Agent

前端 未结 5 1122
故里飘歌
故里飘歌 2020-12-07 21:48

I have a website I am developing that is also going to be pulled into a web app. I have the following code in my .htaccess file to prevent access from ANYONE th

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 22:35

    Allow from and Rewrite* are directives from two different Apache's modules.

    The first one is mod_authz_host and the other from mod_rewrite.

    You can use mod_rewrite to do what you want:

    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} !=myuseragent
    RewriteRule .* - [F,L]
    

提交回复
热议问题