我的 .htaccess 文件更改(例如)example.com/brands/beams/... 為 example.com/php/mvc.php?htTargUrl=brands/beams/... 以及 QSA規則。規則如下:RewriteRule ^(.+)$ php/mvc.php?htTargUrl=$1 [QSA,L,B,BNP,NC]我需要從原始網址中刪除 htTargUrl 參數。例如: example.com/brands/beams/?htTargUrl=beams&par2=val 至 example.com/brands/beams/?par2=val。我嘗試了很多規則來執行此操作,但沒有一個適用于查詢字符串。 如果我使用RewriteCond %{QUERY_STRING} ^(.*)&?htTargUrl=[^&]+&?(.*)$ [NC]
RewriteRule ^/?(.*)$ /$1?%1%2 [R=301,L]則參數不僅從原始鏈接中刪除,而且 URL 變為example.com/php/mvc.php。我怎樣才能做到這一點?
如何使用 .htaccess 從 url 中刪除 get 參數?
幕布斯7119047
2023-12-15 15:05:31