So here’s what I’m trying to accomplish. I have this link, I want to 301 redirect:
Origin URL:
https://www.example.com/folder1/page.aspx?fh_location=%2f%2fpackages%2fnl_BE%2fpr_earlybookable%3E%7b0%7d%2fpk_active%3d1%2fpk_siteswitch%3E%7bnvb%7d%2fpk_country%3E%7biso_pt%7d%2fpk_city%3E%7bgeo_9833%7d%2fpr_duration%3E%7b0608%7d%2fpk_hotelonly%3d0&fh_sort_by=pr_defaultprice&fh_secondid=nbs_city_cli16a_s18&fh_view=detail&fh_eds=%C3%9F&RoomOccupation1=CLI16A_2a_LO_2_0
Condition 1: I have a list of Directories such as folder1
, folder2
, folder3
, folder4
. I want to redirect only if the URL contains any of the folders listed above, but not for folder5
or any other folders not listed above in the URL.
Condition 2: Now comes the tricky part; in the destination it should take the id cli16a
from the URL fh_secondid=nbs_city_cli16a_s18
and then append to the destination URL as seen below
Condition 3: Now the most tricky part. Add that Y
to the destination URL, which represents the folder in the origin URL, eg., folder1
= Y
, folder2
= O
, folder3
= B
, folder4
= C
.
So far I have come up with the below.
RewriteMap WE NEED TO GET A MAPPING OF TYPE OF HOTEL (not sure what to put here)
RewriteCond %{REQUEST_URI} ==(folder1|folder2|folder3|folder4) [NC]
RewriteCond ${conv-lc:%{QUERY_STRING}} (fh_secondid)=[^_]+_[^_]+_([^_]+)_
RewriteRule ^/nl/_USE RewriteMap Matching text here/ ( not sure what to put here)