Php HTTP redirect not working on Azure App Service

Solution:

I suggest you choose windows platform when create webapps.

You can try to create web.config file under the wwwroot folder, if it doesn't exist. If you can find this file when deployed your webapp, you need to modify it.

The specific content to be added or modified is that RewriterConfig needs to be added to web.config.

The format is as follows:

<configSections>
 <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler,URLRewriter" />
</configSections>
......
<RewriterConfig>
   <Rules>
      <RewriterRule>
        <LookFor>^default/([0-9]+)/([_0-9a-z-]+)</LookFor>
        <SendTo>11.aspx?id={R:1}</SendTo>
      </RewriterRule>
   </Rules>
</RewriterConfig>

For more details, you can refer to the following two posts:

Azure Web App Angular Not redirecting to www

DNN UrlRewrite (“DotNetNuke.HttpModules.UrlRewriteModule, DotNetNuke.HttpModules”) does not run custom rewrite rule on web.config

Answer

Solution:

Step 1: Enable Apache .htaccess

By default, the .htaccess file is not enabled.

1. Open the default host configuration file by entering the following command in the terminal:

sudo nano /etc/apache2/sites-available/default

2. Locate the section labeled <Directory /var/www>. In that section, change the AllowOverride None entry to all:

AllowOverride All

Save the file and exit.

3. Next, restart the Apache service:

sudo systemctl apache2 restart

Source