php - Recursive mod_rewrite for search engine friendly urls -
I am reading through a recursive mod_rewrite problem which is what I am trying to do, what is the difference between a I am sending all queries through the index.php file and therefore there is no need to specify the script in the query.
Basically, I want to convert the parameter to any number within a friendly search engine's URL:
example.com/param1/val1/param2/ Val2 / ...
For a regular query string:
example.com/index.php?param1=val1&am2=val2& ...
So far I have failed in my efforts:
rewrite% {QUERY_STRING} ^ (. *) $ RewriteRule ^ ([^ /] +) / ([^ /] +) $ 1 = $ 2 & amp;% 1 [L] rewrite% {QUERY_STRING} ^ (. *) $ Rewrite ^ (. *) $ Index.php?% 1 [ L]
Can anyone be able to give suggestions?
I copied other queries from that solution and modify it like this:
rewrite% {QUERY_STRING} ^ (. *) $ Rewrite rule ^ (. * /)? ([^ /] +) / ([^ /] +) $ 1? $ 2 = $ 3 and amp;% 1 [L] rewrite the scandal% {QUERY_STRING} ^ (. *) $ Rewrite ^. * $ Index.php?% 1 [L]
It does almost the same thing, except for the first rule, the first match is optional and in the second rule, the match matches all other pairs Whatever is left after it is on it.
For a strange number of parameters, the first parameter is ignored.
A note, if you expect a lot of parameters, then you may have to change some settings.
Add something like this to your .htaccess file
RewriteOptions MaxRedirects = 20
and so on in your Apache Conf file
LimitInternalRecursion 20
Whatever you are allowed to do instead of "20" (the default is 10).
Comments
Post a Comment