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.
Related Posts:
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
- Force HTTPS using .htaccess – stuck in redirect loop
- 301 redirect not working through .htaccess
- Site redirects to wrong url when saving settings
- How to redirect url requests to https? [closed]
- Index in root, wordpress in subdirectory
- 302 redirect instead of 301 after switch to HTTPS
- How do I skip wordpress’s 404 handling?
- Redirect from https to http or from http to https? [closed]
- Redirect too many times htacces switching to https
- htaccess redirect – directory and subpages to a single page
- Can WordPress redirect to a “similar page” in case of 404 error
- htaccess redirect dynamic posts
- Hacked website redirect, only on desktop, help with restoring it [closed]
- RedirectMatch and Redirect interfering with each other
- How to hide that a certain non-WordPress directory exists on the server?
- Menu links only using http after enabling https, unable to redirect http links
- https multiple redirects
- How to create a 301 redirect that doesn’t apply to subsites
- Why does multisite bypass WordPress for wp-content, wp-admin, wp-includes and .php files?
- WordPress multisite htaccess redirection to new domain
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- https redirect (with .htaccess) redirect loop
- htaccess 301 redirect http to https doesn’t work
- Redirecting old post url to 404 in wordpress using htaccess
- How to redirect subcategories to a page?
- Use htaccess to redirect WordPress to static website in a subfolder
- Redirect blog archive into certain format
- CNAME vs A Record for WWW – with 301 Redirects
- How to publish new posts/pages in root instead of subfolder, but keep old structure in place?
- forward domain name to particular page?
- htaccess redirect – replace special character
- Redirect from sub-directory to root – New WordPress 5.2.3 Set up
- How to redirect URL with subfolder to the same URL but without subfolder?
- htaccess 301 Redirect not working for WordPress site
- What is the right way to redirect all traffic to HTTPS?
- Site loads very slowly (4-5 minute load time)
- Redirecting amp url to non amp url
- How can I redirect a URL to an anchor link while maintaining the URL?
- I need to redirect an entire subdirectory in WordPress to the homepage – is this correct?
- 503 Service Unavailable error was encountered
- SSL and www to non-www redirection works only on homepage – WordPress
- Redirecting old permalink structure to new in htaccess
- WordPress keeps redirecting subpages without http to https homepage after switch
- Redirect htaccess does not work correctly with my new wordpress site
- How to remove the [L] Flag for WordPress index .php mod_rewrite
- 301 (static page instead latest posts)
- ReDirect subfolder link to another sub-folder and force SSL
- Redirect – remove custom query string
- What is the most efficient (ie. less server intensive) way for 301 redirects?
- How to forward all requests starting with a specific folder name to the same folder
- Issue redirecting ‘blog’ to ‘news’ in WordPress using .htaccess
- Will deleting WP’s code in .htaccess cause problems?
- Use two different index pages
- I want to resolve Redirect Chain [closed]
- How to fix URL with pageid example /?p= too many redirection error
- How to redirect an old page url to the homepage
- How can I redirect a request to the site root using htaccess, if there’s not a specific cookie set?
- Redirect old query string URLs to new add_rewrite_rule URL
- redirecting an entire WP site from one top level domain to another
- Is there way to redirect all blog post pages to Home page?
- get_bloginfo prints IP instead of url
- How to redirect multiple subfolders back to root domain?
- How to redirect non existent pages/posts in wordpress using htaccess
- Temporary Infinite Redirect Loop
- A question about .htaccess
- Date based redirects of posts that no longer exist
- WordPress Pagination – 301 Redirect Issue
- 301 all old pages to new location
- Use a 301 to Redirect any 404 from at the blog post level to the blog archive
- ErrorDocument 410 gives me back a 302 header
- Understanding Redirects
- Error in /blog redirection – ubuntu default WP installation
- WordPress not linking correctly with .htaccess redirect to subdirectory
- 302 redirect *.at/site redirecting to .comsite
- How to create multiple Rewrite-Rule for various site in single htaccess?
- Loading /wp-content/uploads/site as /site/
- WordPress site not forcing from http to https instead getting redirected too many times
- Redirect only PDFs in different folders?
- How do I skip wordpress’s 404 handling?
- Allow GET request on certain page
- home page redirect loop after update to 4.8
- Cannot get 301 redirection in htaccess to work (either Redirect or Rewrite)
- .htaccess redirect for old subfolder installation to new subfolder installation and https
- How to 301 redirect to subdirectory but keep access to wp-admin of main domain
- Pagination redirect set in .htaccess file is not working
- .htaccess not working after page slug change
- Redirecting a POST to a php script
- htaccess and redirect to new url using regex
- How to redirect correctly a root domain to a subdomain in a subfolder?
- Debugging a redirect loop affecting only certain pages
- How to permanent redirect old domain to new one. in case amazon store
- WordPress on a subfolder but accessible from root
- Need rewrite for URL with specific string
- How does the flow of htaccess files in sub-directories work
- WordPress redirect from one directory to another but exclude wp-admin and wp-login.php
- Can I redirect the http request towards an old folder to the homepage using .htaccess file? [closed]
- How to Redirect Url to homepage?
- Other pages fine but wp-admin showing ERR_TOO_MANY_REDIRECTS Error