Hello, I have a problem,
My Netlify website is smb-im.netlify.app
, and I bought the domain smb.im
on Namecheap.
Long story short, I have a DNS issue, I know how to add a subdomain on Namecheap and add it on Netlify, but I don’t know how to make the subdomain display, replace, and work exactly like a non-root folder directory.
The issue in detail:
In my repository (from Github, its private), the directory (for example) repo:[root]/en/
is the main page of my website, andrepo:[root]/my-blog/en/
is the blog page on my website.
Now, when I bought the domain on Namecheap, I wanted for smb.im/en/
to display the main page of my website, and–of course–it worked, but I want for blog.smb.im/en/
to display my blog page, not smb.im/my-blog/en
to do it.
Of course, I added a CNAME with the host as blog
, and the IP as smb-im.netlify.app.
on Namecheap, I even configured the www
host, and added the custom domain blog.smb.im
in Netlify, I activated Netlify DNS (though i’m using PremiumDNS on Namecheap), and HTTPS is enforced.
But it doesn’t work, blog.smb.im/en/
keeps showing me smb.im/en/
's content, and to actually go to my blog page i must go to smb.im/my-blog/en/
, and I don’t want that, I wanted the URL with the subdomain blog
to do the job, so I needed to find a way to link blog.smb.im
to the directory folder /my-blog/
. (And of course any sub-paths should follow the pattern, like a “wildcard redirect”, or like a “/*
”.)
I tried a lot of things to solve this issue but none of them worked:
-
I asked the AI Chatbot “ChatGPT 4o-mini”, It told me to make a forced 200 status code using the
_redirects
file or thenetlify.toml
file in my repository, but none of that worked. -
I tried to make a different Netlify website and called it
blog-smb-im.netlify.app
, and made the base directory as/my-blog/
, but the hyperlinks are a mess, and references from the root directory can’t reach the base directory (like CSS or JavaScript files in the root directory, the blog website were style-less and with no script because it could never reach the root directory) -
I tried to redirect it from Namecheap, but the URL changes, it doesnt remain with the subdomain.
Can anyone help me solve the issue? And actually find the solution to this?
PS. I’m sorry if the way I explained it was complicated, I’m not really good at simplifying my explainations