mod rewrite with cookie

Posted on 2011-05-09
Last Modified: 2012-05-11
Could you help me with a mod rewrite rule with that allows access to a file if they have a certain value for a certain cookie and doesn't allow if they don't have it.  thanks
Question by:hillelben
    1 Comment
    LVL 4

    Accepted Solution

    # check for existence of the cookie, before allowing download
    RewriteCond %{HTTP_COOKIE} (?!SomeCookie=.+)  
    RedirectRule ^/location/.*  /denied.php?loc=$0      [L]

    This will redirect /location/* to /denied.php?loc=/location/*   if SomeCookie is not present

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now