Skip to content

Instantly share code, notes, and snippets.

@evemilano
Created December 7, 2017 13:57
Show Gist options
  • Save evemilano/e6707187af701510861a95194ce84d17 to your computer and use it in GitHub Desktop.
Save evemilano/e6707187af701510861a95194ce84d17 to your computer and use it in GitHub Desktop.
WordPress 301 redirect after permalink change
## From permalink "Day and Name (/%year%/%monthnum%/%day%/%postname%/)" to "postname"
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://www.yourwebsite.com/$4
## From permalink "Month and Name (/%year%/%monthnum%/%postname%/)" to "postname"
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://www.yourwebsite.com/$3
## From permalink "Numeric (/archives/%post_id%)" to "postname"
RedirectMatch 301 ^/archives/(\d+)$ http://www.yourwebsite.com/?p=$1
@evemilano
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment