首页 > 解决方案 > 在 azure 应用程序中部署后出现 404 Not Found 错误

问题描述

我创建了一个基本的 PHP 文件并尝试通过 FTP 和 git 进行部署,在这两种情况下,URL 都指向 Hostingstart.html。我试过给https://<site-name>.azurewebsites.net/index.php,它需要 404 Not Found。

任何人都可以帮助我吗?

标签: azure-web-app-service

解决方案


如果您使用的是Windows环境,则需要一个名为web.config的文件,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Pretty URLs to index.php" stopProcessing="true">
          <match url="^(.*)

 
<pre wp-pre-tag-1="">

如果您使用的是Linux环境,则需要一个文件.htaccess,请参阅此示例


推荐阅读