我有一个分别基于Yii + Yii2框架构建的网站+服务应用程序.我尝试将其托管在Azure xxxxxx.azurewebsites/上.建立在Yii1上的网站运行正常.在Yii2端点上建立的服务返回404.这些服务在本地工作.
I am having a website + services app built on Yii + Yii2 framework respectively. I tried hosting it on Azure xxxxxx.azurewebsites/ . website which was built on Yii1 was working fine. Services built on Yii2 endpoint returning 404. the services are working in local.
以下是详细信息:
Local: Xampp server htdocs/ myapp/ dashboard/ ---> this the website folder (Yii) modules/ v1/ -----> here are my yii2 services and controllers.现在,当我在本地尝试使用url时: localhost/myapp/v1/srvc/srvdetails工作正常.
Now when I try locally with url: localhost/myapp/v1/srvc/srvdetails is working fine.
当我尝试Azure URL时,即 xxxxxx.azurewebsites/v1/srvc/srvdetails 不起作用.
When I try Azure URL i.e. xxxxxx.azurewebsites/v1/srvc/srvdetails not working.
有人可以帮助我吗?
推荐答案根据您的描述,似乎您的应用程序中有一个 .htaccess 文件隐藏了 index.php 模式.由于PHP脚本由Azure Web Apps上的IIS处理,因此您可以尝试生成具有以下内容的 web.config 文件,而不是您的 .htaccess :
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"?> <configuration> <system.webServer> <directoryBrowse enabled="false" /> <rewrite> <rules> <rule name="Hide Yii Index" stopProcessing="true"> <match url="." ignoreCase="false" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration>否则,您可以为我们提供完整的应用程序结构,以进行进一步的诊断.如有任何其他疑问,请随时告诉我.
Otherwise, you can provide your complete application structure for us for further diagnosis. Any further concern, please feel free to let me know.
更多推荐
Azure上的Yii2 Webapp无法正常工作
发布评论