RewriteRule ^(.*)_(.*)/$ /$1-$2/ [R=301,L]
RewriteCond -$1-$2 ^(-)(.*)_(.*)|^-(.*)
RewriteCond -%2%1%3%4 ^(-)(.*)_(.*)|^-(.*)
RewriteCond -%2%1%3%4 ^(-)(.*)_(.*)|^-(.*)
RewriteCond -%2%1%3%4 ^(-)(.*)_(.*)|^-(.*)
RewriteCond -%2%1%3%4 ^(-)(.*)_(.*)|^-(.*)
RewriteRule ^(.*)_(.*)/$ /%2%1%3%4/ [R=301,L]
RewriteRule ^(.*)ö(.*) https://site.ru/$1o$2 [R=301,L]
RewriteRule ^(.*)ü(.*) https://site.ru/$1u$2 [R=301,L]
RewriteRule ^(.*)õ(.*) https://site.ru/$1o$2 [R=301,L]
RewriteRule ^(.*)ä(.*) https://site.ru/$1a$2 [R=301,L]
location ~ [^/]\.php(/|$) {
...
fastcgi_param SCRIPT_FILENAME "/Users/yarovikov/.composer/vendor/laravel/valet/server.php";
...
}
location ~* ^/wp-content/uploads/.+?\.(rar|zip|7z)$ {
rewrite (.+) /wp-content/themes/test-theme/inc/nginx-file-request.php?path=$1 break;
root /Users/yarovikov/Sites/localhost/test-site;
fastcgi_pass "unix:/Users/yarovikov/.config/valet/valet.sock";
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
RedirectMatch 301 ^/(catalog1)/[^/]+/([^/]+\.html)$ /$1/$2
RewriteEngine on
RewriteRule ^(catalog1)/[^/]+/([^/]+\.html)$ /$1/$2 [R=301,L]
\W
нужно поставить пробел.(\w+ ){4}people
RewriteRule ^(.*)$
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?site\.com [NC]
RewriteRule ^old/page$ https://site.ru/new/page [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?site\.com [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteRule ^/
тут не нужен /
Первому RewriteRule передается путь от того места, где находится .htaccess, до запрошенного файла. Эта строка никогда не начинается со "/".
Если же mod_rewrite используется в<VirtualHost>
, он будет работать по-другому:
В<VirtualHost>
в RewriteRule попадает весь путь запроса, начиная от первого слеша, заканчивая началом параметров GET:-> "/news/category/post.html". Эта строка всегда начинается со /.http://example.com/some/news/category/post.html?comments_page=3
return 301 https://$host$request_uri;
proxy_pass
.server {
listen 443 ssl;
server_name ваш-домен.ру;
proxy_pass https://берём-содержимое.ру;
proxy_cookie_domain берём-содержимое.ру ваш-домен.ру;
RewriteCond %{THE_REQUEST} "! /catalog/filter/"
RewriteCond %{THE_REQUEST} "! /catalog/product/"
RewriteRule ^catalog(/.+)$ /catalog/product$1 [L,R=301]
$text = 'Просто текст 12345';
$matches = [];
$text = preg_replace_callback('~[0-9]~', function($match) use(&$matches) {
$matches[] = $match[0];
return '';
}, $text);
var_dump($text, $matches);
preg_match('/\x{fe0f}\x{20e3}/u', $str, $match);
var_dump($match);
Redirect 301 categoriya https://site.ru/categoriya-new
RewriteEngine on
RewriteRule ^categoriya$ /categoriya-new [R=301,L]
RewriteRule ^podcategoriya$ /podcategoriya-new [R=301,L]
RewriteRule ^categoriya/podkategoriya/(\S+)$ /categoriya-new/podkategoriya-new/$1 [R=301,L]
location = /bitrix/admin/1c_exchange.php {
auth_basic off;
fastcgi_pass php-fpm:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# первая страничка
location = /info/site1-page/page {
alias /home/sites/site_1/index.html;
}
# вторая страничка
location = /info/site2-page/page {
alias /home/sites/site_2/index.html;
}