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>
import re
text = 'head[#f]i[#r#s[t#]c[#second#]tail'
for m in re.finditer('\[#(.*?)#\]', text):
print(m.group(1))
$regex = "/SELECT aaa FROM bbb WHERE BINARY value='((?:\\\\.|[^'])*+)'/";
preg_match($regex, $text, $match);
location /admin/ {
rewrite (.*) $1?branding=1 break;
proxy_pass http://site2.com;
}
RewriteCond %{REQUEST_URI} [A-Z]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ https://site.ru${lc:%{REQUEST_URI}} [L,R=301]
s/pattern/substitution/[infq]
|
там можно свободно использовать s/pattern/a || b/
n
, то и шаблон будет обработан как обычная строка s/a || b/abc/n
|
нужно экранировать s/a \|\| b/abc/
.s/\Qa || b\E/abc/
. 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]
location /forum {
root /var/www/dev.example.com;
try_files $uri $uri/ /forum/index.php$is_args$args;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} " /(index\.php|([^?]*)/index\.php)"
RewriteRule ^ https://www.example.com/%2 [R=301,L,NE]