.htaccess to web.config iis issues route
Asked Answered
A

0

1

Good night. I have a site in php/apache and the file of configurations of routes is the .htaccess. I need pass the site to azure plataform web.config But, I can not work the routes in the IIS. I did a schematic of how the site works.

enter image description here

I want to hide the .php extension and make the route work 100%. The url https://mysite.azurewebsites.net/notify/f/43 has 2 variables: f and 43.

My first .htaccess file from the \wwwroot\site directory and my second .htaccess file from folder_1 directory is: (they are the same)

<IfModule mod_rewrite.c>

RewriteEngine on

# If a script is called without .php extension, but with /variables
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([a-zA-Z0-9\\._-]*)?/(.*)$ $1.php/$2 [QSA,E=PATH_INFO:/$2,L]

# If a script is called without .php extension, and without /variables
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [QSA,L]

# Fix PHP Authentication with FastCGI mode
RewriteCond %{HTTP:Authorization} !''
RewriteRule .*php - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

</IfModule>

Thank you very much for the attention. I look forward to having some response. =)

Ashtoreth answered 7/1, 2019 at 1:9 Comment(8)
Are you using PHP on Azure like this? learn.microsoft.com/en-us/azure/app-service/…Longeron
Also, does your app have a web.config yet? If so, please post. Here is an example that handles index.php but needs rewrite rules added to handle the/notify... route.Longeron
gist.github.com/SyntaxC4/3139686#file-web-configLongeron
@Longeron I am using php on azure yes! My application has a file 'web.config'. But I can't make it he work! In apache the script it works 100%. E need change to web.configHeartstrings
@Longeron this web.config --> pastebin.com/VfnKKtGg work in my case in the route https://mysite.azurewebsites.net/notify/f/43 but for https://mysite.azurewebsites.net/folder_1 not show index.phpHeartstrings
@Longeron and still with this config pastebin.com/VfnKKtGg. Displays site but with Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS in https://mysite.azurewebsites.net/notify/f/43Heartstrings
I don't have access to a PC right now, so my help is pretty limited :) But I think the "sans php" rule and default document are fighting. I would remove the "sans php" rule and use the default document from the GIST that I linked you too.Longeron
@Longeron You would be the only one who could help me .. I did what you said. I removed the 'sans php' rule and I put the default GIST document and I still did not succeed = /Heartstrings

© 2022 - 2024 — McMap. All rights reserved.