I can not capture GET value by means of htaccess

0

These are my rules of .htaccess

# Impedir que se pueda ver el listado de contenidos de un directorio

Options All -Indexes

# Url Amigables

RewriteEngine on

RewriteRule ^([a-zA-Z0-9\-]+)$ index.php?action=$1

the variable I send is

<a href="editarfactura?action='.$item["numerofactura"].'" class="edit" ><i class="material-icons" data-toggle="tooltip" title="Editar"><span  class="glyphicon glyphicon-edit"></i></a>

and I show it with:

echo $_GET['action'];

but the get what it shows me is "editfactura" instead of what the variable has.

    
asked by Alberto Julio Arce Escolar 04.02.2018 в 18:11
source

1 answer

0

Change the href="editarfactura?action='.$item["numerofactura"].'" directly to href="'.$item["numerofactura"].'"

with the RewriteRule ^([a-zA-Z0-9\-]+)$ index.php?action=$1 I think you take the whole url, then it appears the editarfactura appears. Maybe do a: RewriteRule ^editarfactura/([a-zA-Z0-9\-]+)$ index.php?action=$1 for the friendly url to be href="editarfactura/'.$item["numerofactura"].'"

I have not tried it, but it should work

    
answered by 04.02.2018 в 19:08