RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/robots.txt$ [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
server {
listen 80;
server_name site.ru www.site.ru;
root /var/www;
location = /robots.txt { }
location / {
return https://site.ru$request_uri;
}
}