0

I was using this WordPress permalink string.

/%year%/%monthnum%/%postname%.html

but now I want to change it to, and redirect all old URLs to new URLs

/?p=65

Sample old URL is:

http://www.example.com/dead-hahaha_bruhhh.html

The new URL will be:

http://www.example.com/?p=123

My .htaccess file is currently using default WordPress vars. How can I 301 redirect all my old URLs to new URLs?

I tried to use this, but it's not working.

1
  • The "WordPress permalink string" which you say you were using does not match the "sample old URL" you have given? "I tried to use this" - You tried to use what?
    – MrWhite
    Commented Aug 29, 2017 at 19:06

2 Answers 2

2

Just choose Plain permalink settings on /wp-admin/options-permalink.php page. Wordoress would auto redirect all posts.

1
  • 2
    It should be pointed out that when changing permalink structure, the redirect that happens is basically a guess using a LIKE query on the slug. There are cases where you will end up getting redirected to the wrong post.
    – Milo
    Commented Aug 29, 2017 at 19:05
-1

Use the below snippet that's for another question that i have already respond:

https://wordpress.stackexchange.com/a/417549/143910

1
  • I think that does the opposite of what this question is asking?
    – Rup
    Commented Jul 19, 2023 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.