J
J
John Freeman2016-08-09 13:26:44
PHP
John Freeman, 2016-08-09 13:26:44

How to make a parameter in url?

Hello!
I have the following in .htaccess:

RewriteRule ^([a-zA-Z]+)/games/([A-Za-z0-9-?._]+)$ /games/index.php?lang=$1&name=$2 [L]

how can I make it possible to add additional parameters to the url, but not through htaccess, but directly in the address bar!
For example:
now I have a url like this: site.ru/ru/games/starcraft
how can I set the parameter like this:
site.ru/ru/games/starcraft?hideblock=true
where hideblock is the parameter that is passed $_GET request to the file /games/index.php
in /games/index.php I write:
<?php
$hideblock = $_GET['hideblock'];
echo $hideblock;
?>

and in htaccess I write:
RewriteRule ^([a-zA-Z]+)/games/([A-Za-z0-9-?._]+)?hideblock=([a-zA-Z]+)$ /games/index.php?lang=$1&name=$2&hideblock=$3 [L]

and nothing works!
can someone tell me how to make routing in php so that each parameter is not written in htaccess ??
Help me please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
John Freeman, 2016-08-09
@AsviS

The [QSA] parameter solved everything

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question