0

I am currently running a inbuilt server and i want to transfer it to azure. At the moment I run the server with the following command

php -S localhost:8000 route.php

where route.php is my routing script which deals with all my requests. I have looked though the application setting in azure and I cant seem to find the required setting.

AlexanderRD
  • 2,069
  • 2
  • 11
  • 19

2 Answers2

1

PHP applications running on Azure Web Apps are hosted on IIS, and if I haven't misunderstood, you are using route.php as the entrance of your application.

You can configure the Default documents under Application settings blade on Azure portal, enter image description here set the route.php at the first place, then, when the request comes in, the IIS will find the pages one by one under the dufault document list, to handle the request.

Gary Liu
  • 13,758
  • 1
  • 17
  • 32
  • 1
    Wouldn't that deliver a different route.php for each folder? I think the OP is asking for forced traffic regardless of URL even for pages/paths that don't exist. – Brian Berneker Nov 14 '17 at 15:58
0

Web.config can be used to modify to the request before it is processed by the server. Therefore the following script can be used to push the traffic to the routing script

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
<system.webServer>
<rewrite>
    <rules>
        <rule name="SpecificRewrite" stopProcessing="true">
            <match url="^([A-Za-z0-9-/]+)/?$" />
            <action type="Rewrite" url="/route.php?url={R:1}" />
        </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

The match and action parameters each regular expressions so can be modified for advanced routing

AlexanderRD
  • 2,069
  • 2
  • 11
  • 19