<Directory>
можно использовать только в контексте server config, virtual host.AllowOverride None
и Apache не читает .htaccess, либо картинки раздаются вовсе без его участия, например Nginx. RewriteEngine On
RewriteCond %{THE_REQUEST} " /(pages/|[^?]*\.php)" [OR]
RewriteCond %{SERVER_PORT} !443 [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(pages/|)(.*?)(\.php|$) https://site.ru/$2 [R=301,L]
RewriteCond %{DOCUMENT_ROOT}/pages/$1.php -f
RewriteRule ^(.*)$ pages/$1.php [L,QSA]
Invalid command 'AddHandler\xe2\x80\x8b'
в $header если сделать вардамп выводится следующееstring(324) "HTTP/1.1 200 OK Date: Tue, 11 Dec 2018 10:27:40 GMT Server: Apache X-Powered-By: PHP/5.6.28-pl0-gentoo Content-Length: 51408 Cache-Control: public Content-Transfer-Encoding: Binary Content-Disposition: attachment; filename=2018.12.07_[14:28:30]_+74562697525_103.mp3 Accept-Ranges: bytes Content-Type: audio/mpeg "
echo "<pre>", $header, "</pre>";
HTTP/1.1 200 OK
Date: Tue, 11 Dec 2018 10:27:40 GMT
Server: Apache
X-Powered-By: PHP/5.6.28-pl0-gentoo
Content-Length: 51408
Cache-Control: public
Content-Transfer-Encoding: Binary
Content-Disposition: attachment; filename=2018.12.07_[14:28:30]_+74562697525_103.mp3
Accept-Ranges: bytes
Content-Type: audio/mpeg
$header1=preg_replace('~^.+Content-Disposition: attachment; filename=(.+)Accept-Ranges.+$~is','$1',$header);
RewriteCond %{REQUEST_URI} ^(.*/)\d+-([^/]+\.html)$
RewriteRule ^ %1%2 [R=301,L]
RewriteRule ^(|.*/)\d+-([^/]+\.html)$ /$1$2 [R=301,L]
RewriteRule ^(et|ru)/catalog/kuldehted/sormused/pulma-sormused/?$ /$1/catalog/kuldehted/sormused/abielusormused [R=301,L]
RewriteRule ^(et|ru)/(catalog/kuldehted/sormused)/pulma-sormused/?$ /$1/$2/abielusormused [R=301,L]
В оригинале такие ссылки
https://site.ru/news/50/ostorozhno
нужны такие
https://site.ru/50-ostorozhno
желательно на конце со слешем или без, сейчас оба варианта работают.
RewriteRule ^(\d+)-([^/]+)$ news.php?id=$1&slug=$2
/
RewriteRule ^(\d+)-([^/]+)/$ news.php?id=$1&slug=$2
ErrorDocument 404 /notfound.php
location ~ ^/i/imgs?/(.*)$ {
resolver 8.8.8.8;
proxy_pass https://$1;
}
location ~ ^/i/imgs?/img\.site2\.ru/(.*)$ {
proxy_pass https://img.site2.ru/$1;
}
RedirectMatch 301 ^/obshhaya-informatsiya/zemlya$ http://site.ru/obshhaya-informatsiya/zemlya/city
RedirectMatch 301 ^/(obshhaya-informatsiya/zemlya)$ http://site.ru/$1/city