RewriteRule optimization?

0 like 0 dislike
16 views
There is the most long query:
www.site.com/admin/catalog/computers/page3/search/[base64_encode_serialized_array]/filter_by_photo/sorted_by_id/

Modification of the query can be different:
www.site.com/admin/catalog/computers/page3/filter_...
www.site.com/admin/catalog/computers/page3/sorted_...

etc.


These all URLS are processed, I have now one rule:

RewriteBase /

RewriteRule ^/?admin/catalog/([a-zA-Z]+)/(page([0-9]+)/?)?(search/([a-zA-Z0-9]+)/?)?(filter_by_([a-zA-Z]+)/?)?(sorted_by_([a-zA-Z_]+)/?)?/?$ ./index.php?base=Catalog&dbname=$1&p=$3&search=$5&filter_by=$7&sort_by=$9 [L]


But I feel that it is possible to optimize, and would like to make the handling of the parts separately, but I can't find how to do it, ie something such that, if:


RewriteBase /

RewriteRule ^/?admin/catalog/([a-zA-Z]+)/?$ ./index.php?base=Catalog&dbname=$1 [C]

RewriteRule ^/?page([0-9]+)/? &p=$1 [C]

RewriteRule ^/?search/([a-zA-Z0-9]+)/? &search=$1 [C]

RewriteRule ^/?filter_by_([a-zA-Z0-9]+)/? &filter_by=$1 [C]

RewriteRule ^/?sorted_by_([a-zA-Z0-9]+)/? &sort_by=$1 [L]


I.e. the algorithm should be something like finding the right beginning, and on it hung Supplement. Is it possible? And if so, how?
by | 16 views

2 Answers

0 like 0 dislike
Perhaps we should make the logic processing parts of Apache and relegated to the PHP script. Again, it will be easier in which case leave to another server.
by
0 like 0 dislike
I have just broken all to pieces at the first input parameter in the URL.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked May 20, 2019 by artmirarmi
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
28,874 users