^(?: (word1) | (word2) | ... )+
(?(id/name)yes-pattern|no-pattern)
https://docs.python.org/3/library/re.html(?>...)
, которая не поддерживается в Python, но её можно имитировать с помощью позитивной опережающей проверки (?=...)
pattern = r"""
(?xm)
^
(?=
(
(?: \b (?P<a> белый | серый | красные ) \b
| \b (?P<b> бегемот[ы]? |гиппопотам[ы]? ) \b
| \b (?P<c> дикий | злой ) \b
| \w+
| [^\w\n]+
)+
)
)
(?(a)|(?!))
(?(b)|(?!))
(?(c)(?!)|)
"""
upstream api {
server 127.0.0.1:7777;
}
server {
listen 80;
listen [::]:80;
server_name example.com;
root /home/iam/project/dist;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://api/;
}
location /static/ {
try_files $uri @cdn_uploads;
}
location @cdn_uploads {
root /home/iam/cdn/uploads;
rewrite ^/static(/.*)$ $1 break;
}
}
location /api/ {
proxy_pass http://starter_api/;
}
location = /api {
proxy_pass http://starter_api/;
}
<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]
proxy_cache_path /var/cache/nginx levels=2 keys_zone=pagecache:5m inactive=10m max_size=50m;
server {
listen 80;
server_name domain.ru;
root /var/www/html;
rewrite ^/(pricing|contacts)/?(.*) /$2;
location ~ \.(js|css)$ {
try_files $uri @custom_cache;
}
location / {
try_files $uri/index.html $uri @custom;
}
location @custom {
proxy_pass http://ru_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location @custom_cache {
proxy_cache pagecache;
proxy_cache_valid 10m;
proxy_pass http://ru_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
rewrite ^/(.*(?:pdf|epub))$ /wp-content/themes/divi-child/download.php?file=$1;
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]
httpd configuration files contain one directive per line. The backslash "\" may be used as the last character on a line to indicate that the directive continues onto the next line. There must be no other characters or white space between the backslash and the end of the line.
php_admin_value open_basedir = "\
E:\Websites;\
C:\PHP\includes\
"