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.

How to limit access to an URL with query parameters

Discussion in 'Apache' started by Juza, Sep 5, 2016.

  1. #1
    Hello,

    my experience with apache is ~ 0 and I need your help. My problem is the following:

    I need that an URL is accessible only for some defined users. In the URL there is a query parameter and that is the discriminator.

    The URL could be something like this:

    https://my.my.com/my-app/view/myView.xhtml?myQueryParam=allUsers

    Googling a little I came upon this possible solution:

    RewriteEngine on
    RewriteCond %{REQUEST_URI} "/my-app/view/myView[.]xhtml.*"
    RewriteCond %{QUERY_STRING} myQueryParam=allUsers
    RewriteRule .* - [E=no_auth_required:1]

    <LocationMatch "/my-app/view/myView[.]xhtml.*">

    Require uniqueID user1ID user2ID

    </LocationMatch>

    Between xhtml and ? could come additional strings too, therefor the *

    This works but the problem is that it also denies the access to for ex. the link https://my.my.com/my-app/view/myView.xhtml?myQueryParam=somethingElse

    It seams that it doesn't bother the value of the query parameter...

    What do I miss?

    Thank you in advance.

    Greetings
    Francesco
     
    Juza, Sep 5, 2016 IP
  2. Juza

    Juza Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    I forgot to say that I' using Apache 2.2...
     
    Juza, Sep 8, 2016 IP