I’d like to redirect in
ht.access
To clarify, it’s .htaccess
, not ht.access
.
You can do something like the following at the top of the .htaccess
file, before the existing WordPress directvies:
RewriteRule (.*/)page/\d+/?$ /$1 [R=302,L]
The above issues a 302 (temporary) redirect for any URL of the form /<something>/page/<number>/
(trailing slash optional) to /<something>/
.
The $1
backreference contains the captured URL-path before the page/<number>/
part at the end of the URL-path.
Always test with a 302, even if this should be a 301 (permanent) redirect later.
There is no need to repeat the RewriteEngine
directive, since that should already appear later in the file.