htaccess condition specific pages

I am having a little issue with my htaccess, what my goal is and what is currently working on my WordPress site is:

/blog/title-of-blog-post/1923

is being redirected to

Read More
/title-of-blog-post/

That is done with this rule:

RewriteRule ^blog/(.*)/.*/$ $1/ [R=301,L,QSA]

However, that means it is also redirecting

/blog/page/2/ to /page/
/blog/page/3/ to /page/
etc

Is there a condition to which I could stop the /blog/page/nr being redirected, but still keep those rules as they are?

Many thanks

Related posts

Leave a Reply

1 comment

  1. You could add an RewriteCond before your rule.

    RewriteCond %{REQUEST_URI} !^/blog/page/[0-9]+/?$
    RewriteRule ^/?blog/(.*)/.*/?$ $1/ [R=301,L,QSA]
    

    You could probably optimize it a bit if needed.

    Hope it helps you forward.