Page 1 of 1

301 redirect with htaccess

Posted: Tue Dec 29, 2020 7:56 am
by mikeinterserv
I am trying to redirect incoming urls from google from an older site.
I have tried htaccess redirect and rewrite but can only get SOME of the redirects to work.

I cannot get either of these to work
Redirect 301 /index.php?route=product/category&path=341_319 https://mydomain.co.uk/Shop/red-cars/ford-red
RewriteRule ^index.php?route=product/category&path=341_319$ /https://mydomain.co.uk/Shop/red-cars/ford-red/ [END,R=301]
and this
Redirect 301 /accessories/Roll-Film https://mydomain.co.uk/Shop/all-parts-a ... -roll-film
goes to
https://mydomain.co.uk/Shop/all-parts-a ... /ROLL-FILM
it takes the last part of the incoming url and instead of redirecting fully it redirects partly but replaces all-roll-film with ROLL-FILM which I just cannot fathom at all

I CAN get these to work
Redirect 301 /red-cars https://mydomain.co.uk/Shop/red-cars/ford-red
Any help would be much appreciated

Re: 301 redirect with htaccess

Posted: Tue Dec 29, 2020 11:42 am
by rjcalifornia
mikeinterserv wrote:
Tue Dec 29, 2020 7:56 am
I am trying to redirect incoming urls from google from an older site.
I have tried htaccess redirect and rewrite but can only get SOME of the redirects to work.

I cannot get either of these to work
Redirect 301 /index.php?route=product/category&path=341_319 https://mydomain.co.uk/Shop/red-cars/ford-red
RewriteRule ^index.php?route=product/category&path=341_319$ /https://mydomain.co.uk/Shop/red-cars/ford-red/ [END,R=301]
and this
Redirect 301 /accessories/Roll-Film https://mydomain.co.uk/Shop/all-parts-a ... -roll-film
goes to
https://mydomain.co.uk/Shop/all-parts-a ... /ROLL-FILM
it takes the last part of the incoming url and instead of redirecting fully it redirects partly but replaces all-roll-film with ROLL-FILM which I just cannot fathom at all

I CAN get these to work
Redirect 301 /red-cars https://mydomain.co.uk/Shop/red-cars/ford-red
Any help would be much appreciated
I don't know why are you doing that, but this should help:

http://httpd.apache.org/docs/current/mo ... write.html

Also the RewriteRule doesn't include the query string. You will need to set up 2 rules:
1. One that redirects the ugly url to the nice url.
2. One rule needs to rewrite the nice url to an actual working url

Re: 301 redirect with htaccess

Posted: Tue Dec 29, 2020 12:08 pm
by cedcommerceteam
Hello,

Hope you are doing well.

Please have a look at the following link -

https://opencart.tips/seo-redirection-opencart

Hope this will you.

Thanks!!!