praveen seela praveen seela - 1 year ago 151
PHP Question

Yii2 webapp on Azure not working

I am having a website + services app built on Yii + Yii2 framework respectively.
I tried hosting it on Azure . website which was built on Yii1 was working fine. Services built on Yii2 endpoint returning 404. the services are working in local.

Here are the details:

Local: Xampp server
dashboard/ ---> this the website folder (Yii)
v1/ -----> here are my yii2 services and controllers.

Now when I try locally with url: http://localhost/myapp/v1/srvc/srvdetails
is working fine.

When I try Azure URL i.e. not working.

Can someone help me?

Answer Source

According your description, it seems that you have a .htaccess file in your application to hidden index.php pattern in URL. As the PHP scripts are handled by IIS on Azure Web Apps, so you can try to generate a web.config file with following content to instead your .htaccess:

<?xml version="1.0" encoding="UTF-8"?>

<directoryBrowse enabled="false" />

      <rule name="Hide Yii Index" stopProcessing="true">
        <match url="." ignoreCase="false" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" 
              ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" 
              ignoreCase="false" negate="true" />
        <action type="Rewrite" url="index.php" appendQueryString="true" />

Otherwise, you can provide your complete application structure for us for further diagnosis. Any further concern, please feel free to let me know.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download