Options -Indexes
ErrorDocument 404 /404.php
<IfModule mod_php5.c>
php_flag allow_call_time_pass_reference 1
php_flag session.use_trans_sid off
#php_value display_errors 1
#php_value mbstring.internal_encoding UTF-8
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpe?g|png|ico|webp)$
RewriteRule ^(.*)$ https://site.ru/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/jpeg "access plus 3 day"
ExpiresByType image/gif "access plus 3 day"
</IfModule>
<Location />
AuthType GSSAPI
AuthName "GSSAPI Single Sign On Login"
GssapiCredStore keytab:/etc/httpd/key.keytab
Require valid-user
Require ip 192.168.10.20
</Location>
<Directory>
доступна только в server config, virtual host.<Directory not allowed here
AllowOverride None
на AllowOverride All
sudo a2enmod rewrite
sudo service apache2 restart
RewriteCond %{QUERY_STRING} (?:^|&)page=(\d+)
RewriteRule ^(.*)$ /$1page/%1/? [R=301,L]
DirectorySlash off
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule (.*) /$1.html [L]
сайт.ру/q?example=1 было сайт.ру/q/example/1
RewriteCond %{QUERY_STRING} (?:^|&)(example)=(1)(?:$|&)
RewriteRule ^q$ https://site.ru/q/%1/%2? [R=301,L]
Modifiers
Particular items can be restricted to print only for responses with specific HTTP status codes by placing a comma-separated list of status codes immediately following the "%". The status code list may be preceded by a "!" to indicate negation.
%!
перечислить через запятую коды ответов которые нужно исключить.CustomLog "logs/access_log" combined "expr=!%{REQUEST_STATUS} -in {'200', '301','302'}"
RewriteCond %{QUERY_STRING} (^|&)PAGEN_1=1($|&)
RewriteCond %{QUERY_STRING} (^|&)SIZEN_1=50($|&)
RewriteRule ^(.*)$ /$1? [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} SemrushBot-SA|rogerbot|megaindex\.com
RewriteRule ^ - [F]
<VirtualHost>
# Переезд на https
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# Убираем www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^$ https://example.com/page/ [R=301,L]
RewriteCond %{THE_REQUEST} " /wp/ "
RewriteRule ^ https://example.com/page/ [R=301,L]
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?>www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{SERVER_PORT}%{HTTP_HOST} !^443(?!www\.) [NC]
RewriteCond %{HTTP_HOST} ^(?>www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{SERVER_PORT}%{HTTP_HOST} ^(?|443www\.(.+)|80(?>www\.|)(.+)) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
server {
listen 443 ssl;
server_name site.io;
access_log off;
ssl_certificate "/var/node/********.crt";
ssl_certificate_key "/var/node/********.key";
root /var/www/service/public_html;
location / {
index index.php index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/api/v2/(.+) {
try_files $uri /api/v2/index.php?q=$1&$args;
}
}
RewriteCond %{HTTP_HOST} ^old-site\.ru$ [NC]
RewriteRule ^(.*)$ http://www.new-site.ru/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+)\.old-site\.ru$ [NC]
RewriteRule ^(.*)$ http://%1.new-site.ru/$1 [R=301,L]
#
old-site.ru -> www.new-site.ru
www.old-site.ru -> www.new-site.ru
one.old-site.ru -> one.new-site.ru
www.one.old-site.ru -> one.new-site.ru
two.old-site.ru -> two.new-site.ru
www.two.old-site.ru -> two.new-site.ru