1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

IF condition in .htaccess or .conf files - internal or external request

Discussion in 'Apache' started by bendyna.vitalii, Apr 28, 2017.

  1. #1
    Hello!

    I'm going to implement interesting thing in my web server configuration.
    So, the main requirement is:
    1) Allow access to some directory if user clicked on a link on the same site
    2) Ask about login and password if request was direct, like written directly in web browser's URL window.
    Something like:
    <Directory /var/www/html/restricted>
       <If "request was not direct">
           AuthType Basic
           AuthName "Restricted Content"
           AuthUserFile /etc/apache2/.htpasswd
           Require valid-user
       </If>
    </Directory>
    Code (ApacheConf):
    Can someone help me with it?
    SEMrush
     
    bendyna.vitalii, Apr 28, 2017 IP
    SEMrush
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    225
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    This approach is not secure, the HTTP_REFERER value cannot be trusted. There is always some way to modify the value.
     
    RoseHosting, May 6, 2017 IP