How to configure mod_rewrite?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
The bottom line is clear: we need to bring all requests to the site /path/to/file.html in file index.php with the appropriate GET parameters. The network has seen a few solutions but not sure what to use right (for example, it is impossible to see the map of clicks with Yandex metrics because of its get-parameters)

That's what I use:

RewriteRule ^([^/]*)\\.html$ /index.php?query=$1 [L]

RewriteRule ^([^/]*)/([^/]*)\\.html$ /index.php?query=$1&id=$2 [L]

RewriteRule ^([^/]*)/([^/]*)/([^/]*)\\.html$ /index.php?query=$1&id=$2microid=$3 [L]

How to do better?
by | 3 views

1 Answer

0 like 0 dislike
I'd have done differently.
Was being parsed the URI string is not in htaccess, and index.php. And all requests for non-existent files are passed unchanged to the index.php. As do all frameworks now. Then _GET parameters all remain, if necessary. Example htaccess (look at the last three conditions):
Then it can be found in the script like this:
and parse already have on your query, the id and microid.

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
27,210 users