Search code examples
phpazureweb-configstatic-files

Enable serving of files with no extension in PHP 7.4 on Azure


I am running Wordpress on Azure under PHP 7.4 and require the ability to serve files with no file extensions on my PHP site.

The url I am trying to load looks like this https://myurl.com/.well-known/acme-challenge/6uVkXzXxHHkm1d6cQiUqI07lrYspInk7i9WCKKl-RlQ

Unfortunately no matter what I seem to do I am still getting a 404 Page Not Found error on WordPress despite the file existing on my server.

Typically in .NET applications all I need to do is add a configuration setting to the web.config like such to achieve the desired result.

<system.webServer>
    <staticContent>
        <mimeMap fileExtension="." mimeType="text/html" />
    </staticContent>
</system.webServer>

I have also tried adding a custom .htaccess file with the following values.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\. - [H=text/html]

but unfortunately the error persists.

Can anyone provide any guidance on how I might be able to get this working?


Solution

  • So it turns out the mistake I was making was trying to place the file in a subfolder called wwwroot inside of wwwroot like you do with a .NET application.

    This was a mistake on my part having come from .NET.

    Upon moving the file to the actual wwwroot folder I was able to successfully resolve my issue.