# domain.ru/page1/ -> domain.ru/page2/ Redirect 301 /page1/ http://domain.ru/page2/ # domain.ru/page1/ -> domain.ru/page2/ <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} ^/page1/$ RewriteRule ^.*$ http://domain.ru/page2/? [R=301,L] </IfModule> # domain.ru -> www.domain.ru <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^([^www].*)$ RewriteRule ^(.*)$ http://www.%1/$1 [L,R=301] # # RewriteCond %{HTTP_HOST} !^www\.(.*) [NC] # RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] </IfModule> # www.domain.ru -> domain.ru <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ RewriteRule ^(.*)$ http://%1/$1 [L,R=301] # # RewriteCond %{HTTP_HOST} ^www\.beta\.domain\.ru$ [NC] # RewriteRule ^(.*)$ http://beta.domain.ru/$1 [R=301,L] </IfModule> # /page/ -> /page <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} !\? RewriteCond %{REQUEST_URI} !\& RewriteCond %{REQUEST_URI} !\= RewriteCond %{REQUEST_URI} !\. RewriteCond %{REQUEST_URI} ![^\/]$ RewriteRule ^(.*)\/$ /$1 [R=301,L] </IfModule> # /page -> /page/ <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} !\? RewriteCond %{REQUEST_URI} !\& RewriteCond %{REQUEST_URI} !\= RewriteCond %{REQUEST_URI} !\. RewriteCond %{REQUEST_URI} !\/$ RewriteRule ^(.*[^\/])$ /$1/ [R=301,L] </IfModule> # domain.ru/index.php -> domain.ru <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} /index.php RewriteCond %{QUERY_STRING} ^\z RewriteRule ^(.*)$ http://domain.ru/? [R=301,L] </IfModule> # domain.ru/index.php?n=1 -> domain.ru/?n=1 <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} /index.php RewriteRule ^(.*)$ http://domain.ru/ [R=301,L] </IfModule> # domain.ru/index.php, domain.ru/index.html, domain.ru/index.htm -> domain.ru <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html|htm)\ HTTP/ RewriteRule ^(.*)index\.(php|html|htm)$ http://domain.ru/$1 [R=301,L] </IfModule> # domain1.ru, www.domain1.ru -> https://domain2.ru <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^domain1\.ru RewriteRule ^(.*)$ https://domain2.ru/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^www.domain1\.ru RewriteRule ^(.*)$ https://domain2.ru/$1 [R=301,L] </IfModule> # domain1.ru/page1, domain1.ru/page2 -> domain2.ru <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} (.*) RewriteRule ^(.*)$ http://domain.ru/ [L,R=301] </IfModule> # domain1.ru/page1, domain1.ru/page2 -> domain2.ru/page1, domain2.ru/page2 <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} (.*) RewriteRule ^(.*)$ http://domain.ru/$1 [L,R=301] # RewriteCond %{HTTP_HOST} ^domain1\.ru # RewriteRule ^(.*)$ http://domain2.ru/$1 [R=301,L] # RewriteCond %{HTTP_HOST} ^www.domain1\.ru # RewriteRule ^(.*)$ http://domain2.ru/$1 [R=301,L] </IfModule> # domain.ru//page/ -> domain.ru/page/ <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{THE_REQUEST} // RewriteRule .* /$0 [R=301,L] </IfModule> # domain.ru/page.html/ -> domain.ru/page.html <IfModule mod_rewrite.c> RewriteCond %{REQUEST_URI} \..+$ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_URI} ^(.+)/$ RewriteRule ^(.+)/$ /$1 [R=301,L] </IfModule> # www.olddomain.ru -> www.newdomain.ru <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.ru$ RewriteRule ^(.*)$ http://www.newdomain.ru/$1 [R=301,L] </IfModule> # beta.domain.ru -> domain.ru/beta/ <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^beta\.domain\.ru$ RewriteCond %{REQUEST_URI} !/beta/ RewriteRule ^(.*)$ /beta/$1 [L] </IfModule> # http -> https <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP:X-HTTPS} !1 RewriteCond %{REQUEST_URI} !robots.txt RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] # # RewriteCond %{HTTPS} !=on # RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] # # RewriteCond %{HTTPS} off # RewriteCond %{HTTP:X-Forwarded-Proto} !https # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # # RewriteCond %{HTTP:X-Forwarded-Protocol} !=https # RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] # # www.domain.ru -> https://domain.ru # RewriteCond %{HTTP_HOST} ^www\.beta\.domain\.ru$ [NC] # RewriteRule ^(.*)$ https://beta.domain.ru/$1 [R=301,L] # RewriteBase / # RewriteCond %{HTTP:X-HTTPS} !1 # RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] # # domain.ru -> https://www.domain.ru # RewriteCond %{HTTP_HOST} ^beta\.domain\.ru$ [NC] # RewriteRule ^(.*)$ https://www.beta.domain.ru/$1 [R=301,L] # RewriteBase / # RewriteCond %{HTTP:X-HTTPS} !1 # RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> # https -> http <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP:X-HTTPS} 1 [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] # # RewriteCond %{HTTPS} =on # RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] </IfModule> # only one url https://domain.ru/page -> http://domain.ru/page <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP:X-HTTPS} 1 [NC] RewriteCond %{REQUEST_URI} ^/DIR_OR_PAGE$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] </IfModule> # only one url http://domain.ru/page -> https://domain.ru/page <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP:X-HTTPS} !1 RewriteCond %{REQUEST_URI} ^/DIR_OR_PAGE$ RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule>