DEV Community

loading...

Discussion on: Deploy React app to Azure App Service as a SPA

Collapse
anthony profile image
Anthony Chu

Hi Fabio,

PHP is the right stack to use for this on Linux. However, it uses Apache instead of IIS, so a web.config file won't work.

Instead, create a .htaccess file in /home/site/wwwroot like this:

RewriteEngine On
RewriteRule "^[^\.]+$" "index.html"

It rewrites any path that doesn't contain a . to the index page, which should work for most single page apps deployed this way. If your app is different, you may have to tweak this somewhat.

Thread Thread
fabiofi profile image
Fabio Author

Many thanks Anthony,
I've changed to Windows instead of Linux and it works. Have a nice day.
Fabio

Forem Open with the Forem app