htaccess configuration to capture all GET data from a query string

Asked

Viewed 353 times

2

I rewrote my url rule as follows:

RewriteRule ^(.+)$ index.php?path=$1 [QSA,L]

In php I get the parameters of $_GET['path'] and configure my controller, action and parameters.

$this->controlador, $this->acao and $this->parametros

If I assemble the url in this format everything works in my application:

http://www.example.com/controlador/acao/parametro1/parametro2/etc...

Since I need to know what is coming from the form. Hence I wanted to pass the query string as parameter. Type:

http://www.example.com/controlador/acao/query_string

Where query_string = id=123&name=jose&dica=ok

The problem is that the global variable $_GET is returning the following:

$_GET['path'] = "controlador/parametro/id=123"
$_GET['name'] = "jose"
$_GET['dica'] = "ok"

It would be possible to see only the $_GET['path'] with the full string. Type:

$_GET['path'] = "controlador/parametro/id=123&name=jose&dica=ok"
  • Partner, either deal with the client side or the server side. When it comes to form, each field is a given, if you do not group it in run-time with javascript (in a single field, type an input[type='Hidden'], then arrange it next to the server, receiving the data and grouping it into a single variable. But $_GET, control data, URL visibility to me doesn’t seem at all safe..

  • Ok may not be safe for critical data. But in case my application makes sense to be so. The problem is that if you pass a querystring via GET automatically on the server it is broken into the global $_GET. If I change the client side querystring it would work.

  • Type replacing "&" with "/": formdata = $("#form"). serialize(); formdata = formdata.replace(/[&]/g, "/"); The result would be "controller/parameter/id=123/name=Jose/tip=ok" I don’t think it’s practical to do this on the client side. My question is whether querystring could be rewritten by some Jquery native method or handled by Rewriterule in htaccess.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.