Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

368
Vistas
How to set nginx redirection to mvc php app?

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..

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

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

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda