Running v4.3 without a Public folder under IIS

I currently have a site in v3.4 and I am moving over to a new server, that I would like to run a v4.3 fresh installation. I am using IIS, because of other applications I need to serve on that machine. I have installed it and it all seems to be working, BUT, now I have a site that always has /public on it, which looks terrible and isn’t very SEO friendly.

I have tried to change my default folder in IIS to the public folder, changing the .env file to not have the public in the basepath. This works for the website itself, but the CMS fails miserably.

I have tried to use a URL rewrite, but that only works on the homepage and none of the others.

Am I missing something?

I like the new CMS, but it seems to have become too complex for a relative noob like me.

Setting the web root to public is the way to go, and should allow the site to run.

How did you install the site? There could be a couple of possible issues, mostly to do with how the front-end resources are delivered.

I followed the instructions for installing on IIS on the website. I downloaded the zip file, installed the prerequisites (PHP 7, MySQL, PHP Manager, etc) then ran the Silverstripe install.php. That completed successfully and allows me to do everything, but with the annoying /public/ in the URLs.

Like I say when I change the web root to public and change the .env file to remove the /public/, the front end website appears to work OK, but when I try to use the CMS I get an error. I have attached a screenshot of the error.

Interestingly I have just tried it again, moving the root and changing the .env file and it was working, until I did a dev/build?flush=1. Now it’s back to the error attached!

Edit: Oh it would appear I am unable to upload the picture.

Hi there,

Thank you for taking time to help me with this. It turns out every time I do a /dev/build?flush=1 the web.config file in the assets folder resets and blocks js and css files!

So I have to remember every time I add a module and rebuild I will need to change the web.config file.

Many thanks!

Can you copy / paste the text of the error?

That’s odd. The web.config file does get regenerated with a dev/build (same as the htaccess does). Manually editing it isn’t supposed to be required.

That’s the file which is used as a the basis for the web.config. You can see that the allowed extensions are looped and included automatically. If they’re not being added properly, then it may be a bug.

So it sounds like it could be a bug then, because it’s definitely happening!

Where do I specify the list of allowed extensions that are picked up in this file?