簡體   English   中英

使用.htaccess重定向並獲取參數

[英]redirect with .htaccess and get parameters

有誰能夠幫助我?

我需要使用get參數重定向請求,如下所示:

http://www.mysite.com/listings/?tx_listingcontroller[countryId]=4&tx_listingcontroller[regionId]=2868&cHash=f59c2ae1b037df6fc8a1e2a55ea0ee96

http://www.mynewsite.com/listings/countryId/4/regionId/2868/cHash/f59c2ae1b037df6fc8a1e2a55ea0ee96

有人知道我該怎么做嗎?

謝謝!

您可以將RewriteRule添加到您的.htaccess文件。 http://httpd.apache.org/docs/current/mod/mod_rewrite.html 這使用RegEx解析傳入的URL,並根據匹配的段將其重定向到新的URL。 就像是...

RewriteRule ^listings/?tx_listingcontroller[countryId]=(.*)&tx_listingcontroller[regionId]=(.*)&cHash=(.*)$ listings/countryId/$1/regionId/$2/cHash/$3

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM