Add to htaccess file:
# Q4LAUNCH Added Redirects
RedirectMatch 301 ^/blog/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$ https://THE-DOMAIN.com/blog/$3
# END Q4LAUNCH
RedirectMatch 301 ^/blog/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$ https://THE-DOMAIN.com/blog/$3
# END Q4LAUNCH
*Be sure to amend THE-DOMAIN.com
*Be sure to place this ABOVE WP’s default mod_rewrite’s
If you also want to handle/remove extensions
# Q4LAUNCH Added Redirects
#first: remove .html file extension – e.g. https://example.com/file.html will become https://example.com/file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]#then: match, remove and redirect /blog/year/month/
RedirectMatch 301 ^/blog/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$ https://whiteoakinn.com/blog/$3
# END Q4LAUNCH
#first: remove .html file extension – e.g. https://example.com/file.html will become https://example.com/file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]#then: match, remove and redirect /blog/year/month/
RedirectMatch 301 ^/blog/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$ https://whiteoakinn.com/blog/$3
# END Q4LAUNCH
To use the Redirection Plugin instead of accessing the htaaccess file:
- Go to Tools > Redirection
- Set your source URL to: ^/blog/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$
- Set your target URL to: https://THE-DOMAIN.com/blog/$3
- Set your group to Modified Posts
- Set the URL options /Regex drop-down to “regex”:
- Click Add Redirect
- Test a few old blog URLs to confirm redirect is working as expected