htacces wont redirect in my webapp RRS feed

  • Question

  • In my web app i have the htacces in my root folder, but dont function. I dont have any error in my htaccess.

    If i try deploy the some code in the OnPremises site function without any problem.

    the content in my htaccess file is:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    #---hide index.php
    RewriteBase /
    RedirectMatch 403 ^/(system).*$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*)$ /index.php/$1 [L]

    Friday, April 24, 2020 5:40 PM

All replies

  • Thanks for posting this good question.
    Apologies for the delay and any inconvenience with this.

    If you’re hosting your WebApp on Azure App Service, you may try the following steps. If it’s Cloud Service or any other Azure service please just let us know.

    Ensure that you are adding
    .htaccess file to your repository root (Wwwroot).

    If you wish to deploy in folder other than wwwroot, you may try with this:

    Create .htaccess in  wwwroot folder with following content (replace newdocumentrootfolder with path to your new folder under wwwroot):

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !newdocumentrootfolder/
    RewriteRule (.*) newdocumentrootfolder/$1 [L]

    The web framework of your choice may use a subdirectory as the site root. For example, Laravel, uses the public/ subdirectory as the site root. If is the case, then please try way:

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule ^(.*)$ /public/$1 [NC,L,QSA]

    After the above modifications, if the issue still persists, please restart the WebApp (if feasible), and then check to see if that helps and let us know for any further assistance with this issue.

    Tuesday, April 28, 2020 11:29 AM
  • Just following-up on my response above to keep you posted.

    We're migrating from MSDN to Microsoft Q&A as our new forums and Azure WebApps has already made the move!  
    In future, you can ask and look for the discussion for Azure WebApps related questions on the respective forums: 
    Note: Since this thread did not land in the right forum it would be moved to the appropriate forum.

    We are actively working to onboard remaining Azure services on Microsoft Q&A.
    We will make a public announcement once complete. 
    Want to Learn more about new platform, see Microsoft Q&A Getting Started: 

    Tuesday, April 28, 2020 11:31 AM