Reputation: 627
Need to use .htaccess to redirect all urls that have blog-entry
in path like this:
http://example.com/blog/blog-entry/blog-title
to this:
http://example.com/blog/blog-title
Tried this per another stack answer, but no luck:
RewriteRule ^blog-entry/(.*)$ $1 [L,R=301,QSA]
Please advise.
Upvotes: 1
Views: 313
Reputation: 784898
Change your rule with this rule:
RewriteCond %{THE_REQUEST} \s/+(.*)/blog-entry/(\S*) [NC]
RewriteRule ^ /%1/%2 [R=301,NE,L]
Since we're using THE_REQUEST
here, this rule will work from site root or /blog
/ directory.
Upvotes: 1