A
A
Alexander2016-06-02 15:45:06
PHP
Alexander, 2016-06-02 15:45:06

Rewrite mod trim extra parameters?

In $_GET comes:

Array ( [IB_CODE] => karter [SEC_CODE] => 4548 [type] => 1?bxrand=1464870999788 )

[type]=1?bxrand=<microtime>should be instead [type]=1
Found that this can be done via rewrite mod in htaccess.
I sketched something like this
#RewriteRule ^([0-9+])/$ ?bxrand=$1 [L,QSA]
But this rule doesn't work.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey, 2016-06-02
@AVEN1Q

You would bring the current set of mod_rewrite rules.
He needs to be corrected.
If it's like this directly based on what is - replace ?bxrand=$1 with &bxrand=$1

A
Alexey Zakharov, 2016-06-02
@konratnox

there was a similar problem on one of the projects, the detailed page did not work, I used this design

$_REQUEST["ELEMENT_CODE"] = preg_replace("/((?<=\\?)bxrand=\\d+&?|&bxrand=\\d+\$)/", "", $_REQUEST["ELEMENT_CODE"]);
$_REQUEST["ELEMENT_CODE"] = rtrim($_REQUEST["ELEMENT_CODE"], "?&");

N
Nurlan, 2016-06-02
@daager

Depends of course on the conditions, but you can make a cast(int) $_GET['type']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question