Why is your API not using pathinfo? You could simply use FallbackResource /app/controllers/ApiController.php then.
On Tue, Mar 13, 2018 at 7:55 AM, Eric Covener <cove...@gmail.com> wrote: > On Tue, Mar 13, 2018 at 3:51 AM, anke.wiene...@gmx.net > <anke.wiene...@gmx.net> wrote: > > Hi, > > > > I have to admit that I am a total amateur concerning apache and its > configuration. However, I am in the need to do so. In order to use an API > to add data into an application which is running in apache2 I need to set a > redirection. > > > > Everything what I found by now does not really help me, probably also as > I do not know the syntax in detail and which files are really important. > > > > I have the Info how this redirection works in Nginx: > > location ~ ^/api/v1/(.*)/?$ { > > rewrite /api/v1/(.*)$ /app/controllers/ApiController.php?req=$1? last; > > } > > > > In words what the redirection needs to do is that all requests that go > to /api/v1/BLAH are redirected to /app/controllers/ > APIController.php?=req=BLAH > > > > The "home" directory is: /var/www/html/elabftw > > and the API stuff is in /var/www/html/elabftw/app/controllers/ > > > > I tried already something like that: > > - creating a .htaccess file in /var/www/html/elabftw/ > > - adding: > > RewriteEngine On > > RewriteRule ^/api/v1/(.*)$ /app/controllers/ApiController.php?req=$1? > [R=301] > > > > ..but it does not work... > > > > I would be very happy and thankful for help - in which file > (.htaccess??), do I need to write what... > > With mod_rewrite, you need to watch out for a few gotchas (that you > unfortunatley walked right into) > > > 1 - if you have access to the real conf, use it over htaccess. Rules > go in your <virtualhost>. > 2 - rules have a slightly different syntax in htaccess -- the leading > prefix of the match is stripped off based on the htaccess location. > Nothing ever starts with / > 3 - if you want to capture the query string, you need to add a > RewriteCond then use the %1 backreference. > > Probably something close here: > https://wiki.apache.org/httpd/RewriteQueryString > > > -- > Eric Covener > cove...@gmail.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org > For additional commands, e-mail: users-h...@httpd.apache.org > >