3 ms·
By the way, the nginx wiki says that you should avoid ifs when possible: http://wiki.nginx.org/IfIsEvil http://wiki.nginx.org/IfIsEvil Wouldn't something like
by Spittie 12y ago
By the way, the nginx wiki says that you should avoid ifs when possible: http://wiki.nginx.org/IfIsEvil http://wiki.nginx.org/IfIsEvil
Wouldn't something like this accomplish the same thing? (Sorry if I'm totally wrong, I'm not really good)
location /google/ {
}
location /y_key_/ {
}
location ~ \.html$ {
return 404;
}
location = /index {
return 404;
}
location / {
try_files $uri @rewrite
}
location @rewrite {
rewrite ^/$ /index.html break;
rewrite .* $uri.html break;
}
- marshallford 12y agoThis is yet another concern of mine. Most of my solutions involve at least 3 if statements. But I need them in order to check if a requested url is a directory or a file and such.
- sondr3 12y agoWhat kind of app are you running that requires you to do something like this for clean URLs?
- eggnet 12y agoThanks, I will try this, it looks like it will work.
- eggnet 12y agoIt does work, thanks!