SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2004
    Location
    australia
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Allow One User Agent to access CGI-BIN

    Hello,

    I dont have access to the server conf file so...

    Using .htaccess how can I deny access to a perl script in the cgi-bin from all user agents including user agents that are unknown but accept from a user agent with a CustomWord in the user agent string.

    Like: "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; CustomWord)"

    Keeping in mind that the CustomWord is the one I want to identify and allow, every other user agent without this word or with no useragent at all will get a banned page.

    I hope this makes sence.
    I tried with a cgi snippet but it doesnt work very well.
    I read about the mod_access, but I dont beleive my host allows it. So is their a rewritecondition rule I can use.
    How would it be written and will the .htaccess file be in the cgi-bin or the root.

  2. #2
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    in my opinion you can't do that with .htaccess but you could by using httpd.conf

    The reason is because usually /cgi-bin/ is set as a ScriptAlias within httpd.conf so when you access
    example.com/cgi-bin/
    Apache won't check your document root, where index.html is stored and where .htaccess can be read, but it will go directly into the cgi-bin directory of your server.
    The cgi-bin directory of your server is usually outside your document root,
    and usually you cannot put .htaccess there.

    Example:
    example.com/.htaccess
    RewriteEngine On
    RewriteRule etc etc

    if you try to access
    example.com/cgi-bin/
    the above .htaccess *won't* be read by Apache

    if you try to access
    example.com/pippo.gif
    the above .htaccess *will* be read by Apache


    Andrea
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •