'~(<h3>(?:(?!</?h3).)*</h3>)((?:(?!my-class).)*?)(<p>.*?</p>)~is'
'~(<h3>.*?</h3>)((?:my-class(*SKIP)(*F)|.)*?)(<p>.*?</p>)~is'
'~(?>(<h3>.*?</h3>)((?:my-class()|.)*?)(<p>.*?</p>))(?!\3)~is'
//l27.0.0
RewriteCond %{HTTP_HOST} ^(www\.|)oldsite\.ru$ [NC]
RewriteRule ^(category1|category2)/.* http://newsite.ru/$0 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.|)oldsite\.ru$ [NC]
RewriteRule ^ http://newsite.ru/ [R=301,L]
location ^~ /files/ {
if (!-e $request_filename){
return 301 http://images.site.ru$uri;
}
}
location ^~ /files/ {
try_files $uri =404;
error_page 404 =301 http://images.site.ru$uri;
}
location ~ /(wp-login|admin)\.php {
set $humantest 0;
if ($http_cookie !~* "humans=checktest") {
set $humantest 1;
}
if ($args ~* (callback|logout|lostpassword)) {
set $humantest 0;
}
if ($humantest = 1) {
add_header Content-Type text/html;
return 200 "<html><body><script>document.cookie='humans=checktest;path=/';location.reload();</script></body></html>";
}
error_page 404 = @fallback;
include fastcgi_params;
fastcgi_pass ...
}
location ~ \.php
server {
listen 80;
server_name xxx.ru;
root /var/www/html/vfm;
index index.php;
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass fastcgi_backend_71;
}
location ^~ /hite {
root /var/www/html;
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass fastcgi_backend_71;
}
}
}
rewrite ^/(?:(.*)/|)index\.(?:php|htm) /$1 permanent;
rewrite ^/(.*)\.(php|htm) /$1 permanent;
rewrite ^/(.*)/$ /$1 permanent;
rewrite ^/page/([^/]*)$ /page.php?param=$1;
rewrite ^/$ /index.php;
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location / {
try_files $uri @extensionless-php;
}
location @extensionless-php {
try_files $uri.php $uri/index.php =404;
include fastcgi.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
error_page 404 /error;
RewriteRule ^news/(sport)$ /pages/news.php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteRule ^news/(sport)$ /pages/news.php?type=sport [L]
RewriteRule ^uslugi/new_usluga/$ /folder/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
[OR]
можно обойти проверку существования папки RewriteCond %{REQUEST_FILENAME} !-d
.RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/uslugi/ [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
DirectoryIndex
сделает свое дело и при запросе существующей папки /uslugi/new_usluga/ будет вызван /uslugi/new_usluga/index.php. Остальные запросы, как и прежде, обработает index.php в корне сайта. Нужно, чтобы захватывал многострочно. Флаг m стоит.
^ $
, а их нет в данной регулярке.s
совпадение будет и с переводами строк. 2. При написании редиректа с главной страницы rukartina.ru перенаправляет на несуществующую страницу https://rakovgallery.ru/index.php
В чем проблема?
RewriteRule ^(.*)$ index.php
, поэтому редиректы нужно добавлять в начало файла, чтобы они срабатывали раньше, чем другие правила.RewriteEngine On RewriteCond %{REQUEST_FILENAME} robots.txt$ [NC] RewriteRule ^([^/]+) $1 [L] RewriteCond %{HTTP_HOST} ^www.rukartina\.ru$ [NC] RewriteRule ^(.*)$ https://rakovgallery.ru/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^rukartina\.ru RewriteRule ^(.*)$ https://rakovgallery.ru/$1 [R=301,L]
RewriteEngine On
RewriteCond %{THE_REQUEST} "! /robots\.txt"
RewriteCond %{HTTP_HOST} ^(www\.|)rukartina\.ru$ [NC]
RewriteRule ^(.*)$ https://rakovgallery.ru/$1 [R=301,L]
(?:.*?\K symbol ){N}
(?:.*?\K\.){3}
\K
https://regex101.com/r/A7aQ0I/2((?:.*?\.){2}.*?)\.
$1 (ЗАМЕНА)
Require expr "req_novary('CF-Connecting-IP') -ipmatch '1.2.3.0/24' "
Require expr "req_novary('CF-Connecting-IP') -ipmatch '7.7.7.7' "
RewriteEngine On
RewriteCond %{HTTP:CF-Connecting-IP} !^1\.2\.3
RewriteCond %{HTTP:CF-Connecting-IP} !=7.7.7.7
RewriteRule ^ - [R=403,L]