Hi, after lots of searching the forum and tinkering, I was able to get a Netlify proxy and custom domain working with my Publish site. However, I cannot figure out how to remove the vault name from the url.
I’ve read and relied on the Obsidian Publish documentation here: Set up a custom domain - Obsidian Help. I also made sure to refer to the Netlify documentation here: Redirects and rewrites | Netlify Docs.
I believe this unanswered post from November is asking the same question as I am: Obsidian Publish - hide homepage filename in URL - #3.
I added the following netlify.toml
to the public repository containing my vault:
[[redirects]]
from = "https://obsidian.MYSITE.ca/*"
to = "https://publish.obsidian.md/MYSITE/serve?url=obsidian.MYSITE.ca/:splat"
status = 200
force = true
I then created a new Netlify site: obsidian-MYSITE.netlify.app
In Hover, I created a new CNAME obsidian
and pointed it at obsidian-MYSITE.netlify.app
And then I added a new primary domain in Netlify, obsidian.MYSITE.ca
Happily, the redirect worked! But, the resulting url is obsidian.MYSITE.ca/MYSITE/...
and I cannot figure out how to prevent the second redundant MYSITE
from being there.
Interesting Note: Adding obsidian.MYSITE.ca
to the Custom URL field in the Publish settings screen “Configure custom domain” and turning on “Redirect to your custom domain” causes the redirect to fail. However, without these settings turned on, navigating to publish.obsidian.md/MYSITE
redirects as expected to obsidian.MYSITE.ca/MYSITE/
. Unless this is where I am going wrong, this detail should probably be clarified in the documentation where it reads:
…configure the site options in Obsidian to the same URL path, by setting Custom URL …