将网址段转换(重定向)为GET参数 [英] Transform(redirect) URL segment to a GET parameter

查看:95
本文介绍了将网址段转换(重定向)为GET参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可能已经回答了这个问题,但是我找不到与我的问题有关的任何东西。

I know this has probably been answered but I can't find anything specific to my issue.

我有这样的URL:

https://staging.books.co.za/travelguide/route-map/SAFI546754
https://staging.books.co.za/travelguide/route-map/SAFI189444
https://staging.books.co.za/travelguide/route-map/SAFI978634

,我需要将它们重定向到这样的URL:

and I need them to be redirected to URLS like this:

https://staging.books.co.za/travelguide/route-map?reference=SAFI546754
https://staging.books.co.za/travelguide/route-map?reference=SAFI189444
https://staging.books.co.za/travelguide/route-map?reference=SAFI978634

请帮助。 ..规则在我的.htaccess文件中是什么样的??

Please help...What would the rule look like in my .htaccess file???

推荐答案

这应该可以解决问题:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^travelguide/route-map/(.+) /travelguide/route-map?reference=$1

请参阅此处的演示 http://htaccess.mwl.be?share=6c2be57a-6bb7-5083-9122-aaf63162b240

这篇关于将网址段转换(重定向)为GET参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆