1

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.

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.