我知道这可能已得到解答,但我找不到任何与我的问题有关的内容。
我有这样的网址:
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:
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文件中的规则是什么样的???
答案 0 :(得分:1)
这应该可以解决问题:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^travelguide/route-map/(.+) /travelguide/route-map?reference=$1
请点击此处查看演示http://htaccess.mwl.be?share=6c2be57a-6bb7-5083-9122-aaf63162b240
答案 1 :(得分:0)
在.htaccess
:
RewriteEngine On
RewriteRule ^travelguide/route-map/([-a-zA-Z0-9_]+)/?$ route-map?reference=$1 [L]
确保在测试之前清除缓存。