2
我試圖使用基於我的網站用戶的用戶名漂亮聯盟網址。的.htaccess重定向鏈接相同的URL,但添加查詢字符串
我需要重定向像一個鏈接:
https://example.com/anything-here/username
要
https://example.com/anything-here/?ref=user_id
我發現這個解決方案:
RewriteRule ^(.*)username(.*)$ https://example.com/?ref=user_id [L,R=301]
它的工作原理,但重定向到我在這裏設置的頁面(在這種情況下,它是主頁)。我的問題是:
我怎樣才能將其重定向到在開始請求的頁面,但刪除用戶名和添加/?ref=user_id
?