Rewrite rule for changing permalinks. Post name to permalink with Category

Đã có trọn bộ đề thi thử THPT Quốc Gia 2022 các môn: vip.dethihsg247.com

SCENARIO A

I have an wordpress site that has existing posts.

Permalink structure is currently configured to https://sitename.com/%postname%/

I need to change the Permalink structure to https://sitename.com/%category%/%year%/%monthnum%/%day%/%postname%/ but when I save these settings https://sitename.com/%postname%/ results to 404 does not redirect to https://sitename.com/%category%/%year%/%monthnum%/%day%/%postname%/

When I remove the /%category%/ and just use https://sitename.com/%year%/%monthnum%/%day%/%postname%/ the 301 redirection from https://sitename.com/%postname%/ works fine

Is there a better way to achieve changing to https://sitename.com/%category%/%year%/%monthnum%/%day%/%postname%/ with proper redirections from https://sitename.com/%postname%/?

Note: I already deactivate all plugins and just used the default twentytwenty theme. I have 11,000 existing posts.

SCENARIO B
(if Scenario A does not work or there is no solution to Scenario A. Im looking at option Scenario B)

Currently I have this but I’m not sure it’s working properly. When I apply this it seems to work for posts that are under “Local News” category. However it breaks my PAGES. PAGES result in 404s.

Is this a correct approach or is my code correct? I’m also not sure if the rewrite rules I made affects other things. Basically I just want to retain permalink/url of the old posts and moving forward I want to follow the new permalink settings. I’m avoiding old posts to result in 404 pages.

Thanks

Xin chào các bạn và quý Thầy Cô. Hãy nhập từ khóa mình muốn vào ô tìm kiếm trên Website để tìm kiếm mọi thứ hoặc trên google các bạn hãy nhập từ khóa + dethihsg247.com để tìm kiếm các bài viết của chúng tôi nhé.
  • Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
  • Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
  • Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.

Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com