Travis Harshaw
Travis Harshaw

Reputation: 38

How to do a 301 redirect for an index.php?dynamic=url

I have 1 old index.php?etc_etc URL I would like to forward to a specific URL, but the 301 redirect is not working.

My rewrite conditions are:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]

I have been using this format to rewrite URLs.

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

This does not work. I imagine because Magento utilizes the index.php for the home page.

How would I permanently redirect that URL to a new one.

Upvotes: 1

Views: 44

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

You can't match against the query string in a Redirect directive. You need to use mod_rewrite and match against the %{QUERY_STRING} variable in a condition. So right below RewriteEngine On, add:

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]

Upvotes: 2

Related Questions