.htaccess 如何为index.php执行301重定向?dynamic=url

.htaccess 如何为index.php执行301重定向?dynamic=url,.htaccess,redirect,.htaccess,Redirect,我有一个旧的index.php?etc_etc URL,我想转发到一个特定的URL,但是301重定向不起作用 我的重写条件是: Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\.html$ /$1 [L,R=301] 我一直在使用这种格式重写URL redirect 301 /ind

我有一个旧的index.php?etc_etc URL,我想转发到一个特定的URL,但是301重定向不起作用

我的重写条件是:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]
我一直在使用这种格式重写URL

redirect 301 /index.php?page=shop.product_details&flypage=flypage.tpl&product_id=948&category_id=114&option=com_virtuemart&Itemid=69 /739619-5004s-garrett-gtp38r-ball-bearing-turbo-kit-99-5-03-7-3l-power-stroke
这是行不通的。我想是因为Magento使用index.php作为主页


如何将该URL永久重定向到新的URL。

您无法与
重定向
指令中的查询字符串匹配。您需要在条件中使用mod_rewrite并匹配
%{QUERY_STRING}
变量。因此,在
上重写引擎的右下方添加:

RewriteCond %{QUERY_STRING} ^page=shop.product_details&flypage=flypage.tpl&product_id=948&category_id=114&option=com_virtuemart&Itemid=69
RewriteRule ^index\.php$ /739619-5004s-garrett-gtp38r-ball-bearing-turbo-kit-99-5-03-7-3l-power-stroke? [L,R=301]

你有一个打字错误,上面写着“^age”,应该是“page”。然而,现在它得到了一个重定向循环错误。错误太多了_REDIRECTS@TravisHarshaw修正了输入错误,我还忘记了规则目标末尾的
。这将防止查询字符串追加到末尾。