7 февраля 2020
Нет комментариев
.htacess:
Header set Access-Control-Allow-Origin *
или php:
header('Access-Control-Allow-Origin: *');
.htacess:
Header set Access-Control-Allow-Origin *
или php:
header('Access-Control-Allow-Origin: *');
в .htaccess
Header always append X-Frame-Options DENY
RewriteCond %{HTTP_HOST} ^site.ru RewriteRule ^spb/(.*)$ http://spb.site.ru/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^(.+)/$ RewriteRule ^(.+)/$ /$1 [R=301,L]
RewriteRule ^(.*)\.html$ https://%{HTTP_HOST}/$1 [R=301,L]
В примере переносим сайт с 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/
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]