Question

I have been adding 301 redirects to my .htaccess file and am having a weird issue where some of them cause a redirection loop (if accessed by any means).

I've noticed this seems to occur if part of the original URL is in the new URL

For example:

RewriteRule ^massey-fergus http://allclass.com.au/massey-ferguson-tractors.html [R=301,L]

Would anyone know whats going on and how to fix this?

Thanks!

Was it helpful?

Solution

Reason is because ^massey-fergus matches your target: /massey-ferguson-tractors.html. Did you mean to not match against the end of the URI?

RewriteRule ^massey-fergus$ http://allclass.com.au/massey-ferguson-tractors.html [R=301,L]

The $ at the end of the regex pattern makes it so it only matches the URI /massey-fergus.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top