这就是我要完成的任务。我有此链接,我要301重定向:
原始网址:
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
条件1 :我有一个目录列表,例如folder1
,folder2
,folder3
,folder4
。我仅在URL包含上面列出的任何文件夹但不为folder5
或URL上面没有列出的任何其他文件夹时才重定向。
条件2 :现在到了棘手的部分;在目标网址中,应从网址"cli16a"
中获取ID fh_secondid=nbs_city_cli16a_s18
,然后附加到目标网址,如下所示
https://www.example.com/be/_CLI16A**Y**/
条件3 :现在最棘手的部分。将“ Y”添加到目标URL,该目标URL表示源URL中的文件夹,例如folder1 = Y
,folder2 = O
,folder3 = B
,folder4 = C
。
到目前为止,我已经提出了以下建议。
**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)