sites/.htaccess
<Files ~ "^(?!.*\.(html|css|js|png|jpe?g|gif|woff2?|ttf)$)">
Deny from all
</Files>
sites/site1/admin/.htaccess
<Files ~ "^.*">
Allow from all
</Files>
RewriteCond %{THE_REQUEST} ^[^?]+\?\s
RewriteRule .* https://site.com/$0? [R=301,L]
RewriteCond %{THE_REQUEST} ^[^?]+//
RewriteRule .* https://site.com/$0 [R=301,L]
RewriteCond %{THE_REQUEST} " /section/%20"
RewriteRule ^ https://site.ru/section/ [R=301,L]
RewriteRule ^section/\s https://site.ru/section/ [R=301,L]
location / {
, а куда-нибудь вроде location ~ \.php$ {
RewriteCond %{THE_REQUEST} ^[^?]+//
RewriteRule .* /$0 [R=301,L]
RewriteEngine On
RewriteRule ^somepage\.html$ https://newsite.ru/somepage/ [L,R=301]
RewriteRule ^somepage2\.html$ https://newsite.ru/somepage2/ [L,R=301]
RewriteRule ^(.*)$ https://newsite.ru/ [L,R=301]
$text = preg_replace('~(\[store [^\]]*\])|\[[^\]]*\]~', '$1', $text);
$text = preg_replace('~\[store [^\]]*\](*SKIP)(*F)|\[[^\]]*\]~', '', $text);
SetEnvIf User-Agent ^(.{0,8}) VarName=$1
%{VarName}e
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_URI}.php [QSA,L]
location ^~ /admin {
root /var/www/admin/public;
rewrite ^/admin/(.*) /$1 break;
try_files $uri /admin/index.php?$args;
location ~ \.php$ {
rewrite ^/admin/(.*) /$1 break;
fastcgi_pass php-fpm;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
/.htaccess
/old/.htaccess
/old/product/ryukzak-srednij-love-moschino/
будет обработан правилами из файла /old/.htaccess
RewriteRule ^old/product/(.+)$ /$1 [L,R=301]
Первому RewriteRule передается путь от того места, где находится .htaccess, до запрошенного файла.
product/ryukzak-srednij-love-moschino/
RewriteRule ^product/(.+)$ /$1 [L,R=301]