I want to redirect 301 to another directory with htaccess when the site is relocated.

Asked 1 years ago, Updated 1 years ago, 474 views

Using WordPress,

blog.example.com/YYYY/MM/DD/post-xx

Sites operating in a directory structure similar to the one shown in

example.com/blog/post-xx

You have moved to .
If so, how do I write htaccesses to redirect the post page of the old site to the new site?

The numbers following post- are common on the old and new sites.
The number of articles on the old site is huge, so I would appreciate it if you could provide a code for all pages.

apache wordpress htaccess

2022-12-14 15:46

1 Answers

I think I can use the capture

RewriteRule^blog/AAA/BBB/CCC/post-(.+)$https://example.com/blog/post-$1 [R=301,L]


2022-12-15 05:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.