How to change web root?

I have a basic framework application application to deploy to SiteGround.com, which I have read does support Yii, although they have no help documents on their site about it. Per the Shared Hosting article in the Yii2 guide, I need to rename my web root from “web” to “public_html”, the name they use for the web folder. So I’m trying to do that on my local host to test before uploading, but it seems I’m missing a step.

I should mention that my local machine is Windows 10 with IIS as the web server, but I’m pretty sure that SiteGround.com is running Apache, so I have the limitation that I can’t try all of this configuration stuff on my local machine. Nevertheless, I’m trying to change and test as much as I can locally before uploading.

So I renamed my local “web” folder to “public_html”, but now when I start the Yii server (php yii serve --port=8082 on the Windows command line), it responds with

Document root “C:\Users\Dell\Documents\GitHub\BPSETracker/web” does not exist.

I guess I have to change something in a configuration file somewhere, but I can’t find where that is. I’ve searched the Guide, these forums, and the general internet, but come up with nothing that seems relevant. What am I missing?

OR, should I keep it as “web” and do something with .htaccess files? (I’m not very familiar with Apache and .htaccess, but I can educate myself if you tell me that’s the direction I need to go.)

Thanks in advance!

The Shared Hosting article obviously assumes you have FTP access to a directory above the web root. If not, you will need to have the configured web root changed (or use a different solution). To the best of my knowledge, the idea is to have the files above the web root protected from web access.

I understand that, and I do have that access, but there’s still the issue that the host server wants the web root to be called “public_html”, not “web”. Should I just keep it named “web” in my app, and put an .htaccess file somewhere (in public_html? In web? Both?) to make a link between them?

I think the local renaming is just for convenience before you upload the files. The bottom line is that if you put the contents of the web directory in the public_html directory of your host (assuming it’s the web root) and it will show up as YourWebServer/index.php in your browser, you are fine.

Yes, that works!!! Thank you!

I have a similar issue where I use the built PHP built in web server. After changing the name of the local folder /web to /www (which my server uses) I get a similar error message as you got. A workaround for the built in PHP web server is then to tell PHP where the document root is like this: php -S localhost:8080 -t www (instead of php yii serve)