Skip to content

Instantly share code, notes, and snippets.

@EricTendian
Created July 26, 2013 23:12
Show Gist options
  • Save EricTendian/6092860 to your computer and use it in GitHub Desktop.
Save EricTendian/6092860 to your computer and use it in GitHub Desktop.
Nginx rewrite config for colored favicons, based on subdomain. If you have your dev. codebase, staging/qa. codebase, and your prod. codebase on the same server, you can give them different favicons to differentiate between the different branches. All subdomains that start with dev (such as dev.example.com and dev.app.example.com) would get the r…
location ~* /favicon(.*) {
log_not_found off;
access_log off;
root /var/www/default;
}
location = /favicon.ico {
if ($host ~* ^dev\.) {
rewrite ^/favicon\.ico$ /favicon-red.ico last;
}
if ($host ~* ^qa\.) {
rewrite ^/favicon\.ico$ /favicon-green.ico last;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment