我将网站从http转换为https。但是我对文件漫游器和站点地图有任何问题。我想从重定向中排除它们。但是我做不到。当我尝试转到http://samalco.ru/robots.txt时,我得到404。但是对于https来说效果很好。
server {
listen 80;
server_name samalco.ru www.samalco.ru;
root /var/www/samalco.ru;
index index.php;
location ~ \.php$ {............................}
location @rewrite { rewrite ^/(.*)$ /index.php?q=$1; }
location /sitemap.xml { try_files $uri /sitemap-raw/; }
location /sitemap-raw/ { rewrite ^/sitemap-raw/ break; }
location /robots.txt { try_files $uri /robots/; }
location /robots/ { rewrite ^ /robots/ break; }
location / { rewrite ^(.*)$ https://samalco.ru$1 permanent; }
}
server {
server_name samalco.ru www.samalco.ru;
listen 443 ssl http2;
access_log off;
root /var/www/samalco.ru;
index index.php;
ssl_certificate path to certificate;
...................................
if ($host ~* www\.(.*)) {
set $host_without_www $1;
rewrite ^(.*)$ https://$host_without_www$1 permanent;
}
location @rewrite { rewrite ^/(.*)$ /index.php?q=$1 last; }
location /sitemap.xml { try_files $uri /sitemap-raw/; }
location /robots.txt { try_files $uri /robots/; }
location @rewrite { rewrite ^/(.*)$ /index.php?q=$1; }
location ~ \.php$ { ............................ }
}
如何解决此问题?