const url = new URL('https://www.domain.ru/test-url');
console.log(url.pathname);
listen 178.172.137.204:443 ssl http2;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
location / {
на уровень выше т.е. ставить прямо в блок server. location / {
, а прямое обращение к php файлам будет обработано в location ~ \.php$ {
где пароль требовать не будет.if ($request_uri ~ "^(.*)index\.(?:php|html)") {
return 301 $1;
}
%2E
, то запрос должен пройти нормально.https://domain.ru/index%2Ephp
RewriteEngine on
RewriteCond %{HTTP_HOST} ^admin\.old\.ru$ [NC]
RewriteRule .* http://admin.new.ru/$0 [R=301,L]
# ГЛАВНАЯ НЕ ХОЧЕТ РЕДИРЕКТИТСЯ, ТОЧНЕЕ ПОЯВЛЯЕТСЯ ГОЛЫЙ HTML
RewriteRule / https://newsite.ru/ [R=301,L]
# А ВОТ ЭТИ РАБОТАЮТ РЕДИРЕКТЫ
RewriteRule catalog/ https://newsite.ru/about.html [R=301,L]
RewriteRule contacts/ https://newsite.ru/contacts.html [R=301,L]
RewriteRule documets/ https://newsite.ru/documents [R=301,L]
RewriteRule news/ https://newsite.ru/news/ [R=301,L]
RewriteRule price/ https://newsite.ru/price.html [R=301,L]
# ГЛАВНАЯ НЕ ХОЧЕТ РЕДИРЕКТИТСЯ, ТОЧНЕЕ ПОЯВЛЯЕТСЯ ГОЛЫЙ HTML
RewriteRule ^$ https://newsite.ru/ [R=301,L]
# А ВОТ ЭТИ РАБОТАЮТ РЕДИРЕКТЫ
RewriteRule ^catalog/$ https://newsite.ru/about.html [R=301,L]
RewriteRule ^contacts/$ https://newsite.ru/contacts.html [R=301,L]
RewriteRule ^documets/$ https://newsite.ru/documents [R=301,L]
RewriteRule ^news/$ https://newsite.ru/news/ [R=301,L]
RewriteRule ^price/$ https://newsite.ru/price.html [R=301,L]
/$1/
указывать адрес с https и нужным доменом.# Переадресация с добавлением / в конце
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)(?<!/)$ https://site.ru/$1/ [R=301,L]
# редирект на https://
RewriteCond %{HTTPS} =off
RewriteRule (.*) https://site.ru/$1 [R=301,L]
# Переадресация с домена с WWW на домен без WWW
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteCond TestString CondPattern [flags]
CondPattern is usually a perl compatible regular expression, but there is additional syntax available to perform other useful tests against the Teststring:
You can prefix the pattern string with a '!' character (exclamation mark) to negate the result of the condition, no matter what kind of CondPattern is used.
!
нужно добавлять к шаблону без лишних пробелов.RewriteCond %{REQUEST_URI} ! \.html$
%{REQUEST_URI}
- TestString!
- CondPattern\.html$
- [flags]^
<td[^>]*>\s*(.*?)\s*<\/td>
https://regex101.com/r/AHNtuk/1/
Endine nimi\s*<\/td>\s*<td[^>]*>\s*(.*?)\s*<\/td>
https://regex101.com/r/AHNtuk/2