Apply Redirection from Day and name to post name After Permalink Change

Apply Redirection from Day and name to post name After Permalink Change

If you have changed the permalinks from Day and name to post name in WordPress. You may need to redirect old day and name URL to post name URLs. This can be achieved through .htaccess rule and redirection plugin. I am using the redirection plugin in WordPress. Here is the regex code to point all Day and name URLs to post name URLs.

Here’s the regex code you can use in your redirection plugin’s settings to redirect all old “Day and name” URLs to the new “post name” URLs in WordPress:

Redirection plugin screenshot containing regex to redirect day and name to post name urls after changing permalinks

Source URL:

^/\d{4}/\d{2}/\d{2}/([^/]+)/?$

Target URL:

https://yourdomain.com/$1/

Explanation:

The regex pattern ^/\d{4}/\d{2}/\d{2}/([^/]+)/?$ matches the old “Day and name” URL structure in WordPress, where the post URL contains the year, month, day, and post name.

The ([^/]+) part captures the post name, which is then used in the target URL $1.

The target URL https://yourdomain.com/$1/ uses the captured post name in the new “post name” URL structure, which is simply https://yourdomain.com/postname/.

Note: Don’t forget to replace yourdomain.com it with your actual domain name in the target URL. Also, make sure to test the redirection to ensure it’s working as expected.

copebusiness

At CopeBusiness, we are a team of dedicated technical SEO experts who specialize in identifying and fixing intricate technical SEO issues. With our deep understanding of search engine algorithms and best practices, we provide comprehensive solutions that pave the way for improved website performance and higher search engine rankings. In this blog post, we’ll delve into the world of technical SEO and highlight how our team at CopeBusiness can help your business thrive.

Leave a Comment

Your email address will not be published. Required fields are marked *