0

I have a rest api that has to be executed only if the parameter "manual" is present in the request.

I tried with a RedirectMatch directive inside the virtualhost declaration

    RedirectMatch 401 "^\/api\/file\.php\?.*(?!manual).*$

but it does not work. Actually seems that none of the last part of the regexp works.

EDIT: Umh, I just found out that RedirectMatch directive does not match against the query part of the get request...

StriDer99
  • 1
  • 3

1 Answers1

0

Ok. I can do it with mod_rewrite:

      RewriteCond %{REQUEST_URI} ^/api/file\.php$ [NC]
      RewriteCond %{QUERY_STRING}  !^.*\&manual=.*$ [NC]
      RewriteRule ^/api/file\.php - [R=401]

It seems working well so far ;)

StriDer99
  • 1
  • 3