Reputation: 3
I'm trying to do a simple 301 redirect
From
.htaccess
RewriteCond %{REQUEST_URI} ^/old-cat/old-sub-cat/(.*)$
RewriteRule ^(.*)$ /new-cat/%1 [R=301,L]
But as a result I get a new category without a slash
where I made a mistake?
Upvotes: 0
Views: 98
Reputation: 1982
This should also work for you, you do not need a RewriteCond at all:
RewriteRule ^/?old-cat/old-sub-cat/(.*)$ /new-cat/$1 [R=301,L]
But your code is also right.
Browser tend to remember 301 redirects so it could be that this is not coming from your Server at all but from your Browser
It could also be that some other .htaccess maybe in some other directory or the Server configuration or the APP itself do some redirect.
Upvotes: 0