クインシー (小獅) 💜
クインシー (小獅) 💜
SSolidJS
Created by クインシー (小獅) 💜 on 1/11/2025 in #support
How to change base directory
I want to deploy my website on a subfolder of the url. Right now, I have it deployed on my-site.netlify.app I have a website on my-domain.com I want my-domain.com/my-site to work the exact same as my-site.netlify.app (same content) i wrote this in my cloudflare worker.js:
export default {
async fetch(request) {
const url = new URL(request.url);
url.hostname = "hinthar-resources.netlify.app";
const newRequest = new Request(url, request);
return fetch(newRequest);
},
};
export default {
async fetch(request) {
const url = new URL(request.url);
url.hostname = "hinthar-resources.netlify.app";
const newRequest = new Request(url, request);
return fetch(newRequest);
},
};
and made a new route rule to run the worker for my-domain.com/my-site* Also, I'm using absolute paths in SolidJS because my tsx files are like 5, 6 directories deep, and so writing ../../../../../../data/something.json isn't as convenient as writing /src/data/something.json, so I'm worried these assets will break when switching over, but SolidJS typescript will handle these absolute file paths, right? I've got
"paths": {
"~/*": ["./src/*"],
"/src/*": ["./src/*"]
},
"paths": {
"~/*": ["./src/*"],
"/src/*": ["./src/*"]
},
configured in tsconfig.json, so netlify should work with that fine, no? Except it doesn't? I go to my-domain.com/my-site and it shows me a 404 because when inspecting, it is actually going to my-site.netlify.app/my-site, which doesn't exist. So, resources like my-domain.com/my-site/favicon.ico which should translate to my-site.netlify.app/favicon.ico, but instead translate to my-site.netlify.app/my-site/favicon.ico How do I fix this? (Also, the github repo of the solidjs project:) https://github.com/quincynyan/hinthar-resources btw, google says put a <base> tag in the head but 1. i cannot find the head in solidjs 2. even if i do put it in the static rendered index.js, nothing happens, same results, no change.
9 replies