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;
}
It's even easier in nginx.
location ^~ /file_name {
alias /path/to/file_name;
}
Put that before the proxy_pass.