My personal website uses WordPress and I've noticed it generates a type of incorrect URL. GENERATED (INCORRECT) URL EXAMPLES:
h*tp://www.example.com/alphanumeric-string/comment-page-1#comment-4357
h*tp://www.example.com/alphanumeric-string/comment-page-2#comment-4357
h*tp://www.example.com/alphanumeric-string/comment-page-3#comment-4357
CORRECT URL EXAMPLE:
h*tp://www.example.com/alphanumeric-string#comment-4357
GENERATED (INCORRECT) URL EXAMPLES:
h*tp://www.example.com/alphanumeric-string/comment-page-1
h*tp://www.example.com/alphanumeric-string/comment-page-2
h*tp://www.example.com/alphanumeric-string/comment-page-3
CORRECT URL EXAMPLE:
h*tp://www.example.com/alphanumeric-string
So I think I need my .htaccess to strip out "/comment-page-[any number]".
My logic is:
h*tp://www.example.com/[anything] /comment-page-[any number] [anything]
... to become:
h*tp://www.example.com/[anything][anything]
My proposed rule is:
RewriteRule ^(.*)(/comment-page-)([0-9])(.*)$ /$1/$4 [R=301,L]
Is my logic correct, and do I need a RewriteCond before the RewriteRule?
Patrick