I want to make my subdomain to subdirectory in blogger code not working

I have website for example Example.com on blogger and a subdomain blog.example.com

I want to make it as example.com/blog

Sor I run a Cloudflare worker for this Sor that it works like that

And other coding so that every url in the source site changed to this new d url example.com/blog but its not working can anyone help me

The code is

const OLD_URL = "https://blog.example.com"
const NEW_URL = "https://example.com/blog"
async function handleRequest(req) {
  const res = await fetch(req)
  return rewriter.transform(res)
class AttributeRewriter {
  constructor(attributeName) {
    this.attributeName = attributeName
  element(element) {
    const attribute = element.getAttribute(this.attributeName)
    if (attribute) {
        attribute.replace(OLD_URL, NEW_URL)
const rewriter = new HTMLRewriter()
  .on("a", new AttributeRewriter("href"))
  .on("img", new AttributeRewriter("src"))
  .on("link", new AttributeRewriter("href"))
  .on("meta", new AttributeRewriter("content"))
addEventListener("fetch", event => {
  let url = event.request.url.split("/blog")[1]
  .catch(err => new Response(err.toString(),{status:500})))

Did you ever figure this out?