preg_match('!luna-table__cell_type_sqi">([\d\s]+)!u', $html, $match);
$result = preg_replace('!\s!u', '', $match[1]);
DirectorySlash Off
<base>
htmlbook.ru/html/base RewriteEngine On
RewriteRule ^(learn-html5)/(basic|overview)$ /$1/lesson/index.php?id=$2 [L]
RewriteCond %{QUERY_STRING} ^BlogPostSearch(?i:%5B|\[)theme_id(?i:%5D|\])=1$
RewriteRule ^blog/index$ https://mirtreiderov.ru/blog/theme/finanasovie-novosti? [R=301,L]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^blog/index$ https://mirtreiderov.ru/blog [R=301,L]
Redirect 301 /blog/index /blog
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]{0,7})$ /go?id=$1 [L]
^(?=[\dAEIOUaeiouАОИЕЁЭЫУЮЯаоиеёэыуюя]{6,8}$)(\D*\d){3}.*
^(?=[\dB-Zb-zБ-Ьб-ь]{6,8}$)(?!.*[IUOEiuoeОИЕЁЫУоиеёыуiuoe])(\D*\d){3}.*
IndexIgnore .* *.php *.zip css js fonts img
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/myFolder/(css|js|fonts|img)/(.*)$ [NC]
RewriteRule ^ /myFolder/.%1/%2 [QSA,L]
RewriteRule ^([0-9]+)_(.*)/$ list.php?cat=$1 RewriteRule ^([0-9]+)_(.*)/([0-9]+)/$ list.php?cat=$1&page=$3
(.*)
означает любое количество любых символов.^([0-9]+)_(.*)/$
совпадает с 123_text/
и 123_text/345/
. RewriteRule ^([0-9]+)_(.*)/([0-9]+)/$ list.php?cat=$1&page=$3
RewriteRule ^([0-9]+)_(.*)/$ list.php?cat=$1
1. Редирект на https;
2. Редирект на без www + без повторяющихся слешей;
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
[OR]
RewriteCond %{HTTPS};%{HTTP_HOST};%{THE_REQUEST} !^on;(?!www\.)[^;]+;(?!.*//) [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST};%{HTTPS};%{THE_REQUEST} ^(?=(?:www\.|)([^;]+))(?!(?!www\.)[^;]+;on;(?!.*//)) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
server {
listen 123.123.123.123:80 default_server;
server_name 123.com www.123.com;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset off;
index index.php index.html;
set $root_path /var/www/www-root/data/www/123.com/public;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
access_log /var/www/httpd-logs/123.com.access.log;
error_log /var/www/httpd-logs/123.com.error.log notice;
error_page 404 /index.php;
location / {
return 301 https://$host$request_uri;
}
location ~ ^/(bouns)?$ {
fastcgi_param SCRIPT_FILENAME $root_path/index.php;
fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
include fastcgi_params;
}
}
Первому RewriteRule передается путь от того места, где находится .htaccess, до запрошенного файла.
^test/(first|second|third)$
должно быть ^(first|second|third)$
<VirtualHost>
, а в .htaccess запрос будет проходить через все RewriteRule снова и снова, до тех пор, пока он не перестанет меняться.RewriteEngine On
RewriteRule ^(first|second|third)$ index.html [END]
RewriteRule ^(.+)$ 404.html [END]