Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

125
Visualizações
Excluding URLs from Django redirects

Im redirecting all my files on the root of my site to the English subdirectory

url(r'^(?P<zero>([a-z-]*)).(htm|php|html)$', redirect, {'to': '/en/{0}.html', 'permanent': True}),

I want to exclude a specific page. If I were using apache I could easily do this with an alias or a mod rewrite before it hits the Django application. However Im using Nginx and the redirect gets process regardless of the alias. Is there a rule I can use above so a specific page on my root won't get redirected?

the following is an example of my config with using regx, tried it with suggested one above as well (location ^~ /file.html { )

 listen 8007;
    server_name  devel.somedomain.com;
    access_log  /var/log/nginx/somedomain-dev.log;
    error_log /var/log/nginx/error.log;
    real_ip_header X-Forwarded-For;
    set_real_ip_from 0.0.0.0/0;
    #real_ip_recursive on;

    location ~ /help.cgi$  {

        proxy_pass http://localhost:8006;
    }

    location ^~* /file\.html$ {
        alias /home/admin/somedomain/file.html;
    }
    location / {
       proxy_pass http://127.0.0.1:8006;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It's even easier in nginx.

location ^~ /file_name {
     alias /path/to/file_name;
}

Put that before the proxy_pass.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda