Redirecting a subdirectory to a different site with Workers


I have a website at, hosted on pages. I have another website at I want it so when I go to, it loads up the (Ignore the blog part, it was just a name I gave to the website to test).

From what I have read online, it should be quite simple with Cloudflare Workers. I am hosting both websites on Cloudflare Pages, obviously with different names.

I have create a new Worker. Create Service → HTTP handler and pasted the following code:

export default {
  async fetch(request, env) {
    const url = new URL(request.url);

    if (url.pathname.startsWith('/about')) {
      const blogUrl = ';
      const modifiedRequest = new Request(blogUrl, request);
      return fetch(modifiedRequest);
    } else {
      return fetch(request);

I saved and deployed that code. I then went back to the worker, went to Triggers, and added a route. The route I added was*. I also tried and*.

Back in where you edit your code, In the little IDE, I type in and it returns the code from When I run it in the browser, it just goes the 404 page on

Where am I going wrong here??

Also, when I go to the worker, directly from the worker URL https://{my-worker-name}, its trying to bring down the CSS, JS from https://{my-worker-name}/main.js etc.