Regex RewriteRule no Apache 2.4 .htaccess

2
  • Eu quero o URL: http://api.relaunch.local/rest/v1/akb/
  • Para reescrever para: http://api.relaunch.local/?id=1873&eID=dispatch&controller=akb

Onde akb é a parte variável.

Eu tentei uma variação infinita sem sucesso, aqui está minha última tentativa em .htaccess:

RewriteEngine On
RewriteBase /

RewriteRule "^rest/v1/([^/]*)/" "index.php?id=1873&eID=dispatch&controller=$1" [L]

Esta regra está funcionando quando eu uso este serviço de teste: link

Mas não no meu Apache. Estou no Apache 2.4 com PHP-FPM 7.1

Regravar registro:

[Sat Oct 13 19:01:56.394388 2018] [rewrite:trace3] [pid 22532:tid 123145530462208] mod_rewrite.c(482): [client 127.0.0.1:55904] 127.0.0.1 - - [api.relaunch.local/sid#7fff0281a5c8][rid#7fff038892a0/initial] [perdir /Users/bandanh/Sites/relaunch.dev/public/] strip per-dir prefix: /Users/bandanh/Sites/relaunch.dev/public/index.php -> index.php
[Sat Oct 13 19:01:56.395768 2018] [rewrite:trace3] [pid 22532:tid 123145530462208] mod_rewrite.c(482): [client 127.0.0.1:55904] 127.0.0.1 - - [api.relaunch.local/sid#7fff0281a5c8][rid#7fff038892a0/initial] [perdir /Users/bandanh/Sites/relaunch.dev/public/] applying pattern '^rest/v1/([^/]*)/' to uri 'index.php'
[Sat Oct 13 19:01:56.395788 2018] [rewrite:trace1] [pid 22532:tid 123145530462208] mod_rewrite.c(482): [client 127.0.0.1:55904] 127.0.0.1 - - [api.relaunch.local/sid#7fff0281a5c8][rid#7fff038892a0/initial] [perdir /Users/bandanh/Sites/relaunch.dev/public/] pass through /Users/bandanh/Sites/relaunch.dev/public/index.php

vhost:

    <Directory /Users/bandanh/Sites/relaunch.local/public/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        DirectoryIndex index.php index.html
    </Directory>

    <IfModule proxy_fcgi_module>
        <FilesMatch ".+\.ph(ar|p|tml)$">
            SetHandler "proxy:unix:/Users/bandanh/Sites/.vhosts/sockets/php-fpm-71.sock|fcgi://localhost"
        </FilesMatch>
    </IfModule>

    LogLevel alert rewrite:trace3
    
por bandanh 13.10.2018 / 09:05

0 respostas