RewriteCond %{HTTP_HOST} ^(www\.)?site\.ru$ [NC]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ http://m.site.ru/$1 [L,R=302]
RewriteCond %{HTTP_HOST} ^site\.ru$ [NC]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ http://m.site.ru/$1 [L,R=302]
catalog/
добавить (?!books?-)
RewriteRule ^(catalog)/(?!books?-)([^/]+)/$ /$1/books-$2/ [R=301,L]
RewriteRule ^(catalog)/(?!books?-)[^/]+/([^/]+)/$ /$1/book-$2/ [R=301,L]
RedirectMatch ^/(catalog)/(?!books?-)([^/]+)/$ /$1/books-$2/
RedirectMatch ^/(catalog)/(?!books?-)[^/]+/([^/]+)/$ /$1/book-$2/
SetEnvIfNoCase User-Agent "BackupLand" bad_bot
SetEnvIfNoCase User-Agent "Nimbostratus-Bot" bad_bot
SetEnvIfNoCase User-Agent "Photon" bad_bot
Order Allow,Deny
Allow from all
Deny from env=bad_bot
Deny from all
<Files ~ "\.(jpe?g|png|gif)$">
Order deny,allow
Deny from env=bad_bot
</Files>
RewriteCond %{REQUEST_URI} [A-Z]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ https://site.ru${lc:%{REQUEST_URI}} [L,R=301]
RedirectMatch 301 ^/base/$ https://mysite.ru/
RewriteEngine On
RewriteRule ^base/$ https://mysite.ru/ [R=301,L]
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 http://site.ru/404.html
http://site.ru/404.html
и получит код 200 OK
и содержимое этого файла.404 Not Found
.ErrorDocument 404 /404.html
RewriteRule ^text/((\xd0[\x81\x90-\xbf]|\xd1[\x80-\x91])+(?:\s(?2)+)*)/?$ /app/text/detail.php?t=$1 [L]
\p{Cyrillic}
https://www.php.net/manual/ru/regexp.reference.uni...\p{L}
.RewriteRule (*UTF8)^text/(\p{L}+)/?$ /app/text/detail.php?t=$1 [L]
[а-яёА-ЯЁ]
, то файл должен быть сохранён в UTF-8 без BOM.RewriteRule (*UTF8)^text/([а-яёА-ЯЁ]+)/?$ /app/text/detail.php?t=$1 [L]
RewriteRule ^text/((?:\xd0[\x81\x90-\xbf]|\xd1[\x80-\x91])+)/?$ /app/text/detail.php?t=$1 [L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} " /(index\.php|([^?]*)/index\.php)"
RewriteRule ^ https://www.example.com/%2 [R=301,L,NE]
RewriteCond %{QUERY_STRING} ^(view|per_page)
RewriteRule ^(.*)$ /$1? [R=301,L]