Skip to content

Instantly share code, notes, and snippets.

@mborodov
Last active April 18, 2017 03:15
Show Gist options
  • Save mborodov/43b8aaf336698d58069028426d530667 to your computer and use it in GitHub Desktop.
Save mborodov/43b8aaf336698d58069028426d530667 to your computer and use it in GitHub Desktop.
Nginx Bitrix vhost ssl redirect exclude robots.txt and sitemap.xml
set $http 0;
if ($request_uri = '/robots.txt') {
set $http 1;
}
if ($request_uri = '/sitemap.xml') {
set $http 1;
}
if ($http = 1) {
rewrite ^ /robots.txt break;
rewrite ^ /sitemap.xml break;
}
if ($http = 0) {
rewrite ^(.*)$ https://$host$1 permanent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment