I would like to rewrite something like:
http//www.example.com/index.php?var1=val1&var2=val2&var3=val3
IN
http://www.example.com/var1/val1/var2/val2/var3/val3/
I am looking for a solution to work with any number of variables. It can be done?
Take a look at this question: Can mod_rewrite convert any number of parameters with any names?
My answer can be used in your case too:
$_SERVER['REQUEST_URI_PATH'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $segments = explode('/', trim($_SERVER['REQUEST_URI_PATH'], '/')); for ($i=0, $n=count($segments); $i<$n; $i+=2) { $_GET[rawurldecode($segments[$i])] = ($i+1 < $length) ? rawurldecode($segments[$i+1]) : null; }
And the corresponding rule:
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [L]
This rule overwrites any request that cannot be mapped to an existing file or directory, c index.php.
index.php
. , RewriteRule, ( ) , "", , .
, :
RewriteRule ^/index.php - [chain] RewriteRule ^(.*)[=&](.*)$ $1/$2 [next] RewriteRule ^/index.php\? "/"
, , , "/index.php". "chain" , , . an = / /, , , . , , , "/index.php?". .
Source: https://habr.com/ru/post/1708818/More articles:Check Socket File Descriptor? - cGdiPlus OverflowException - c #Critically Efficient Server - javaSharing a simple executable file for multiple users? - c #Perl: moving along input lines using an index - perlJS: tag load equivalent of tag? - javascriptМожет ли mod_rewrite конвертировать любое количество параметров с любыми именами? - regexWebLogic "MDB application is not connected to the messaging system" - java-eehttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1708822/qt-double-buffering-are-there-any-neat-tricks-to-capture-pixels-or-manipulate-the-back-buffer&usg=ALkJrhiJIvsdXJrJG2tBYV-D5NpvWiltiA"Устаревшая" нотация для компилятора Sun С++? - c++All Articles