redirect specific get variable to specific page

I have these weird links showing up Google analytics and when I go to them they are taking me to a 404 page, I cannot find the source to correct them so I would like to redirect them to the correct pages possibly using the .htaccess file.

An example of one is below with some more get variables on the end but they are not useful so I would also like to handle any get variables after but ignore them.

Read More

/404.html?page=/automatic/komatsu-transmission.html(additional get variables)

How do I get this to redirect to this page

/automatic-transmission-repair/komatsu-transmission/

I have tried 301 redirects in the htaccess but they seem to not work for get variables, I believe the answer lies around rewrite rules but I can not seem to create one that works. This is a WordPress install as well so this mite affect the rewrite rules.

I think this answer is going some way to solving my problem but again I cannot get it to work.

Apache Redirect 301 fails when using GET parameters, such as ?blah=

I think something along the lines of this but it’s not working.

RewriteCond %{REQUEST_URI} ^/404.html$
RewriteCond %{QUERY_STRING} ^page=$
RewriteRule ^.*$ /automatic-transmission-repair/komatsu-transmission/ [L,R=301]

Thanks

Related posts

Leave a Reply