Метка

htaccess

Всего: 19 записей

Смена доменного имени .htaccess robots.txt

В примере переносим сайт с site.com на site.org
.htaccess

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} robots.txt$ [NC]
RewriteRule ^([^/]+) $1 [L]
 
RewriteCond %{HTTP_HOST} ^site\.com
RewriteRule ^(.*)$ http://site.org/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.site\.com
RewriteRule ^(.*)$ http://site.org/$1 [R=301,L]

robots.txt

User-agent: Yandex
Host: site.org
 
User-agent: *
Disallow:
Sitemap: http://site.org/sitemap.xml

Источник: https://habrahabr.ru/post/168471/

.htaccess redirect to https

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !/robots\.txt
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Другой вариант, подходит для sweb.ru

RewriteEngine On
RewriteCond %{HTTP:HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
SetEnvIf X-Forwarded-Proto https HTTPS=on

Подходит для nic.ru или infobox.ru

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !/robots\.txt
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Подходит для jino.ru

RewriteCond %{HTTP:X-Forwarded-Protocol} !=https
RewriteCond %{REQUEST_URI} !/robots\.txt
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]