Old version of filters and sorting was creating links like (explenation of every part is below - here is example for same category with different views and filters used):
https://example.com/category-one/1/default/1/f_at_175_3/1
https://example.com/category-two/1/full/3/f_at_185_1/1
https://example.com/category-three/1/default/1/f_at_175_3/1/f_producer_7/1
https://example.com/category-name-and-size-40x40/1/default/1/f_at_175_3/1/f_producer_7/1
We need to redirect them to new link:
https://example.com/category1/1/
Here is my code so far. When I use "htaccess checker" tools, when I use flag "R=301" - there is error like below - so is it even possible to use 301 in this case?:
"Invalid line:RewriteRule is invalid, does it contain a space in the pattern or the substitution?"
RewriteEngine on
RewriteRule ^([a-z0-9-]+)/[0-9]{1,2}/(default|full)/[1-9](/f_[A-Za-z]+_[0-9]{1,3}(_[0-9]{1,2})?/1)+/?$ /$1/ [R=301, L]
detailed info:
Here is structure of these links:
https://example.com/category/A/default/B/f_filter_C_D/E
category
- unique for every category nameA
- number of currently viewed page, so we can have for example 10 pages of category X - in this case here appears 1-10 numbersdefault
- is defining type of view (it's grid or list), and there are only 2 options: "default" and "full"B
- ID of sorting (by name, price etc.), there are only 4 types of sorting (1,2,3,4)f_
- is fixed part that appears everytime you choose any filterfilter
- is defining type of filter used, there are some kind of types of this (at, producer, color etc.)C
- ID of filter, here occur various numbers (1-999)D
- I am not sure what this number do, but it appears always after "filter" part (in range of 1-99)E
- unknown number, but here is always "1"
There are no other directives that are referring to category links inside .htaccess file.