301 redirect help

I am switching CMS platforms and trying to create 301 redirects in htaccess.

This is what I have written but it will not redirect it just displays 404 error page.

RewriteRule ^/category/merchants/123inkjets/?$ stores/123inkjets/ [R=301,NC,L]

What am I doing wrong?

Thanks

Assuming this is Apache 2 (since 1 is almost not used anymore),you need to drop the leading slash:


RewriteRule ^category/merchants/123inkjets/?$ stores/123inkjets/ [R=301,NC,L]

I assume you have RewriteEngine On in your .htaccess too somewhere above that RewriteRule?

Also, since this is pretty simple redirect, I’d use mod_alias instead of mod_rewrite. Simply


Redirect 301 /category/merchants/123inkjets http://yourdomain.com/stores/123inkjets/

:slight_smile:

Awesome. Thanks! Works perfectly.