This solved both parts:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^archives/(.*)$ /\?p=$1 [R=301,L,QSA]
</IfModule>
The QSA
flag maintained the query string automagically.
Most importantly, I had to put it above the existing WordPress rewrite rules in order for it to work.
Related Posts:
- How to prevent automatic redirection of 404 errors and “incorrect” URLs?
- Disable WordPress URL auto complete
- Redirect user to original url after login?
- Disable ONLY URL auto complete, not the whole canonical URL system
- User redirect to destination URL after login
- Redirecting WordPress /.htaccess / HSTS / SSL
- Why does WordPress automatically redirect URLs with the parameter “name=” to a different page?
- How to setup 301 redirects for multiple query string URLs?
- Stop unwanted WP redirection to new url
- How does WordPress redirect to WooCommerce shop page? [closed]
- WP redirects all pages from new domain to old domain
- Does WordPress automatically redirect url without parent slug?
- How to redirect visitor to a custom URL using PHP code in functions.php
- Redirect home to another page with htaccess
- Why does wp_redirect strip out %0A (url encoded new line character) and how do I make it stop?
- How to redirect URL with subfolder to the same URL but without subfolder?
- How to redirect a page into file?
- How to redirect after login getting a variable from url (for example with the language)
- How can I replace my primary url globally with a parked one?
- URL redirect problem
- Adding rewrite rule dynamically for search results redirecting to 404 URL
- How to redirect to clean links with this code
- reducing number of URL Redirects and increasing speed
- URL masking of subdomain to main domain using .htaccess
- Disable WordPress URL auto complete
- Redirect user to original url after login?
- Redirect non existing page to frontpage
- store URL global before we redirect
- WP_List_table with form of method=GET redirects to wrong url after submit
- Redirect old URL (with different post ID) to new URL
- How to fix automatic redirects?
- My redirect URL doesn’t show any pages on my website [closed]
- Preventing Canonical Redirect for CDN
- URL redirection
- URL redirect regular expressions redirecting all after first viriable
- Disable WordPress URL auto Redirect
- How to get user details by name
- Redirect only PDFs in different folders?
- How to disable WordPress URL autocomplete / recognition?
- using wp_rewrite but keep the original url in the address bar
- I’ve move my site but URL still goes to the old site
- Redirect based on $_GET parameters
- International characters in slugs to redirect to
- URL Custom Rewrite
- How to handle expired assets/content when user has direct URL
- How to change Ugly link?
- Redirect ignore last URL segment
- Changing attachment urls?
- Site redirects to wrong url when saving settings
- Remove lost password form and URL
- How To Only Allow Users To View Their Own Buddypress Profiles? [closed]
- htaccess redirect dynamic posts
- RedirectMatch and Redirect interfering with each other
- Menu links only using http after enabling https, unable to redirect http links
- Redirect all pages to homepage but still allow dashboard
- some url does not redirect from http to https
- Why can’t I access files / directories outside of wordpress
- Change ‘Back To Website’ link in wp-login.php
- htaccess rules not applied?
- Intercept the “lost password” action by first redirecting to an existing instructions page
- Changing siteurl and homeurl – internal links redirect to home page?
- redirect Login problems
- 301 redirection editing .htaccess doesn’t work
- Redirect custom post type from one domain to another domain
- 301-redirect directives for blogger to wordpress migration
- Some admin pages redirecting to front page on save
- Stop Redirecting to and from www
- How can I disable author pages without 301 redirects?
- Redirect specific URL before other redirects take place in .htaccess?
- Redirect Main Home Page url to category URL without plugin
- W3 Cache redirects to front page when I press purge all caches
- Force 404 redirect to home?
- Is it possible to wp_redirect() to a new tab?
- How to delete a post and keep its slug to refer to another post
- Dynamic 404 page content while still keeping 404 status code?
- Redirect Image Url to a page via htaccess
- WordPress redirect to new domain name
- Blog post is redirecting to home page
- Trying to re-direct users to specific page based on an ACF variable
- wp_redirect is only working in Chrome Network, page is not redirecting
- How to remove redirection
- Unusual Apache2 Error Causing WordPress Redirect Error?
- Redirect error after updating WordPress to 5.4.2
- 301 Redirect Loop www to non-www – Nginx + Apache2
- how to redirect 404 to attachment.php?
- I get “too many redirects” problem when migrating localhost site
- Internal redirect from page to category
- Configure WordPress to listen on a port other than 80
- Do I need to keep the original page when 301 redirecting to a new one?
- Any way to make Apache’s internal redirect work?
- Redirect attachment URL
- Conditional redirection with logout
- Logging back into WordPress after logging out and having issues with ‘loggedout=true’ in redirect URL
- 301 redirect for wordpress permarlink
- Need rewrite for URL with specific string
- Redirect to 404.php from single.php
- How does the flow of htaccess files in sub-directories work
- How to Show different page URL instead of default home page URL
- How to Redirect Url to homepage?
- 404 Not Found with All Cloaking plugins