使用 htaccess redirect 编辑参数

edit parameter with htaccess redirect

一些 URL 在 PrestaShop 的单个产品页面上有参数 ?content_only=1。我想将这些参数重定向到 ?content_only=0.

URL 结构如下所示: https://www.onlineruitershop.nl/paardendekens/3953-esperia-two-fleece-deken.html?content_only=1 这应该更改为 https://www.onlineruitershop.nl/paardendekens/3953-esperia-two-fleece-deken.html?content_only=0

第一个 / 之后是类别,第二个 / 之后是产品的名称和 ID。这应该不受影响。 谢谢。

你可以试试这条规则:

RewriteCond %{QUERY_STRING} ^(.*)content_only=1(.*)$
RewriteRule ^(.*)$ /?%1content_only=0%2 [L,R=301]

Here is the result