RewriteCond %{HTTP_HOST} ^(www\.)?site1\.ru$
RewriteRule ^$ https://site2.ru/ [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?site1\.ru$
RewriteRule ^catalog/krovlya/(profnastil/)?$ https://site3.ru/$0? [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?site1\.ru$
RewriteRule ^catalog/krovlya/gibkaya_cherepitsa_/$ https://site3.ru/catalog/krovlya/gibkaya-cherepitsa/? [R=301,L]
RewriteCond expr "! (%{QUERY_STRING} =~ /(?:^|&)key=([^&]+)/ && md5(%{REQUEST_URI}) == $1)"
RewriteRule ^orders/1\. - [F]
/orders/1.jpg
хеш MD5 58fa4178ea5e540a0e02f726a807dc8f
Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as http in front of it), Apache HTTP Server will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server. This has several implications, the most important being that the client will not receive the original error status code, but instead will receive a redirect status code.
ErrorDocument 404 /404.php
RewriteRule ^(test\.php)$ https://username:password@dev.test.com/$1 [R=302,L,NE]
<IfModule mod_rewrite.c>
# Enable rewrite rules
RewriteEngine on
# Base directory
RewriteBase /
# Deny direct access to .txt files
RewriteRule ^content/(.*)\.txt$ - [R=404,L]
RewriteRule ^\d+$ my.php [L]
# All URL process by index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [PT,L]
</IfModule>
RewriteEngine on
RewriteRule ^chtotam$ /fignya/chtotam [R=301,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
RewriteEngine On
RewriteCond %{THE_REQUEST} " /sites/index\.php\?action=site&cid=([^ &]+)"
RewriteRule ^ /game/%1? [R=301,L,NE]
RewriteCond %{QUERY_STRING} ^art_(id=.*)
RewriteRule ^(article)$ /$1?%1 [R=301,L]
server {
listen 80;
server_name www.site.ru;
return 301 http://site.ru$request_uri;
}
server {
listen 80;
server_name site.ru;
root /var/www/html;
rewrite ^/rss\.xml$ /data/rss.php;
rewrite ^/sitemap\.xml$ /data/sitemap.php;
location @handler {
rewrite ^/(.*)$ /data/engine.php?a=$1;
}
location / {
try_files $uri $uri/ @handler;
}
location ~ \.php$ {
try_files $uri =404;
# Тут нужно добавить свои параметры fastcgi
}
}
Как вариант что-то вродеRewriteCond %{HTTP:X-Forwarded-Proto} http(s) [NC] #RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] RewriteRule ^331/$ /best/http%1/%2/3 [L,R=301]
с коментом работает %1 а вот со вторым кондом уже нет ;(
!
не затрёт результаты предыдущего.RewriteCond %{HTTP:X-Forwarded-Proto} http(s)| [NC]
RewriteCond %{HTTP_HOST} !^www\.(.*) [NC]
RewriteRule ^(.*)$ http%1://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond "s %{HTTPS} %{HTTP_HOST}"
s on site.ru
s on www.site.ru
s off site.ru
s off www.site.ru
RewriteCond "s-%{HTTPS} %{HTTP_HOST}" "^(?:(s)-on|\S+) (?!www\.)(.*)" [NC]
RewriteRule ^(.*)$ http%1://www.%2/$1 [R=301,L]
RewriteCond "s-%{HTTPS} %{HTTP_HOST}" "^(?:(s)-on|\S+) www\.(.*)" [NC]
RewriteRule ^(.*)$ http%1://%2/$1 [R=301,L]