First of all, I'm sorry if this question is pretty much a best practice question, rather than me asking for some help from you guys.
Basically, I'm new to webmaster stuff (as I am a web developer, but I've never had to manage domains / hosting before.
The way I usually work is with having the source code and the distribution code into two different folders, as some of my source gets compiled into the dist folder (some, not everything!)
I also use git as a source code tracker and then on the server I use git command line to push, pull switch branch and so on.
So, the problem I've got is that in git I have both folders (both dist and src) that get pushed.
Let me write down an example:
let's say I have a domain called www.mydomain.com
When I clone the repository into www.mydomain.com
, the server root, if I navigate to the domain, above looks like this:
index of:
src/
dist/
and os to have the proper website, the URL needs to be www.mydomain.com/dist
.
If I append dist at the end, it works, but I don't like it. I so tried to change the server document root in my Cpanel account from /domains/mydomain.com
to /domains/mydomain.com/dist
hoping that this would tell the website to look directly into the dist folder as a root document folder and not the level up.
That, unfortunately, didn't work.
I also tried with a redirect, but again, dist gets appended at the end of the URL.
I also started to look into git post-commit
hooks, but I'm not sure that's the right path to follow.
Basically, after this very long question, all I'd like to know is a best practice to handle two folders pushed on the server with git, but having the URL point to one without having the URL to display the subfolder name. Is that possible? do I need to setup the .htaccess file to do that or is something that needs to be done when setting up the domain name?
Thanks for any suggestion