#azure storage static website
1 messages · Page 1 of 1 (latest)
yes, as long as there is no dynamic content, and the links are relative
Thanks for assisting here. It seems I'm have trouble with the relative links. I have a directory as follows, which is uploaded to the $web directory in storage account.
- test
- index.html
- style.css
- index.html
where /test/index.html references the style.css like so link rel="stylesheet" href="./style.css">. Say my static domain is test.web.core.windows.net when i access test.web.core.windows.net/test the style is being fetch from test.web.core.windows.net/style.css rather than test.web.core.windows.net/test/style.css
Am i doing something wrong here?
are you 110% SURE the href is DOT slash and not just slash style.css
I tried both and neither worked. It seems to just resolve to the root with no relative addressing.
i assume you've been through this article:
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website-how-to?tabs=azure-portal
Yea i saw that. If it helps visualize things, i'm essentially just uploading the files in this zip into $web directory of an azure storage.
Ah looks like it has something to do with Index document name in Static website settings in the left menu. I had it set to index.html. So i was accessing the test directory as https://ktwebstorage.z33.web.core.windows.net/test rather than https://ktwebstorage.z33.web.core.windows.net/test/index.html
ahh... yeah, i renamed it to index2 and referenced it directly just so there wasnt a chance of a conflict
/test is technically a file ref, not a directory ref
so when default index.html is returned, it doesnt look to the browser like its in a subfolder
just use /test/style.css in the reference and you should be good
Ah got it. Don't think it would be feasible to do the last suggestion as its a zip file that I'm downloading from an external source to load into an iframe, and would be challenging to fix all the references. But i don't think i need to set the Index document name at all, can just access the page with the .html extension which should work.
Out of curiosity, I'm guessing there isn't a way to do it like this https://ktwebstorage.z33.web.core.windows.net/test while keeping the relative paths?
this isnt a "azure static website" issue in that case, its the browser trying to pull a relative link
and to it the relative link to "/test" is /
if the link was "/test/" then it would be different
imagine you have an html file in the root folder actually called "test"
now can you see how the browser thinks it needs to get the stylesheet from the root and not the folder?