I have problem with redirection from nginx to php mvc app, because all requests sending from nginx are looking for directory. I would like to send url as params to let the routes in app menage them. Both of them are on different servers.
.htaccess in app:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|svg|json|pdf|php)$ [NC]
RewriteRule ^([^/]+)/? index.php?url=$1 [L,QSA]
</IfModule>
in nginx i tried:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
May i ask for advice how to configure redirection from nginx to mvc app. Is there any tag in header of request which tells the server that request looking for directory?
Example: https://site.domain/Users
In this example Users is a directory, i would like to use it as "string param"
Example of request i received in app:
IP - - [26/Mar/2020:15:13:20 +0000] "GET /Application/Admin?id=1322323 HTTP/1.0" 403 466 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
In this example Application is root directorywhich work correct but after "/" is a Folder.. no param string..
For nginx the following is sufficient (you don't need any query parameter bindings - they'll work just fine)
location ~ ^/ { try_files $uri $uri/ /index.php; }
For Apache I would
RewriteRule ^(.*)$ index.php?url=$1&%{QUERY_STRING} [L,R=301]
let us know the result