We’ll need to check the directory structure of the PHP app to see why it isn’t starting.
- Go to KuduLite and select WebSSH
- Change directories to "home/site/wwwroot" and list the contents
root@e157e0a1aec8:/home# cd /home/site/wwwroot root@e157e0a1aec8:/home/site/wwwroot# ls –ltra
- The hostingstart.html file is still there and there is no index.php file in the root directory.
- Depending on the PHP framework being used, the default document will be in certain locations. For Symfony, the index.php is under “public”.
- Go to https://<sitename>.azurewebsites.net/public.
- The site is there but it’s not formatted correctly.
Resolution
- To resolve the issue, we’ll need to create rewrite rules to use the “public” directory when the site is reached. C
- Create a “.htaccess” file using the following steps.
- Using WebSSH, go to /home/site/wwwroot, type “vi .htaccess”.
- In the vi editor, press “i” to begin writing.
- Add the following. You can copy and paste but make sure to right click in the SSH window to paste.
RewriteEngine on RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L]
- To save, press “ESC” then “:” and finally “wq!” and press ENTER.
- Go back to https://<sitename>.azurewebsites.net and you’ll see the site appear as it should. No need to restart.