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.
8 Replies
peerreynders
peerreynders3w ago
https://github.com/solidjs/solid-start/issues/1158#issuecomment-1870933249 I'm not entirely sure it's relevant but perhaps the: - options.start.server.baseURL configuration - import.meta.env.SERVER_BASE_URL value and - base property of the Router component may have a role in all this.
GitHub
[Bug?]: Router "base" property is flaky · Issue #1158 · solidjs/sol...
UPDATE (moving focus from base prop in vite.config to base prop on Router): For repro instructions, see #1158 (comment) Duplicates I have searched the existing issues Latest version I have tested t...
peerreynders
peerreynders3w ago
FYI: <Base /> only places a <base> element in the document <head>.
MDN Web Docs
: The Document Base URL element - HTML: HyperText Markup Language |...
The HTML element specifies the base URL to use for all relative URLs in a document. There can be only one element in a document.
Random Mesh
Random Mesh3w ago
If it's a vite project, you can go base: "" in your vite.config.ts, then everything will be relative path. If your trying to fetch in a web worker, you may have to use postMessage to pass path information from the main UI thread. Because no window object in worker thread.
クインシー (小獅) 💜
i tried that but it still doesn't work
クインシー (小獅) 💜
am i doing it right?
No description
No description
クインシー (小獅) 💜
and when i mean by "not working", i mean the routing works but js and css doesnt in production
No description
クインシー (小獅) 💜
shouldn't they be under /resources/?
クインシー (小獅) 💜
the routing does work and the hyperlinks too but nothing else is loading
No description

Did you find this page helpful?