All
. Если переключить на Any
, то будет поведение как нужно.AuthType Basic
AuthName "Restricted Resource"
AuthUserFile /var/www/.htpasswd
Require valid-user
Order Allow,Deny
Allow from 192.168.1.2
Satisfy Any
<RequireAll>
и <RequireAny>
By default all Require directives are handled as though contained within a<RequireAny>
container directive. In other words, if any of the specified authorization methods succeed, then authorization is granted.
<RequireAny>
.AuthType Basic
AuthName "Restricted Resource"
AuthUserFile /var/www/.htpasswd
Require valid-user
Require ip 192.168.1.2
/file.html
тогда в .htaccess добавить строкуErrorDocument 403 /file.html
root /root/pages;
location = / {
alias /root/index.html;
}
location / {
}
RewriteCond %{REQUEST_URI} ^(.*/)index\.(php|html)
RewriteRule ^ https://site.name%1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.name/$1 [R=301,L]
Require expr %{HTTP_USER_AGENT} !~ m#uTorrent/2040\(21515\)#
изменение запроса не заканчивается на последнем RewriteRule. После того, как сработало последнее правило RewriteRule и был добавлен RewriteBase, mod_rewrite смотрит, изменился запрос или нет. Если запрос изменился, его обработка начинается заново с начала .htaccess.
index.php
так что происходит зацикливание.RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9-_./]+)$ /index.php?url=$1 [QSA,L]
/
перед index.php
тогда mod_rewrite после перенаправления сможет понять что запрос не изменился и остановит цикл. В этом случае допонительный RewriteCond
не нужен.RewriteRule ^([a-zA-Z0-9-_./]+)$ index.php?url=$1 [QSA,L]
/.htaccess
или /custom/.htaccess
указать для 401 какой-нибудь существующий файл. ErrorDocument 401 /file.html
ErrorDocument 401 " Some text "
ErrorDocument 401 default
/.htaccess
исключение для запросов со статусом 401 и пустить их в обход правил Wordpress.RewriteCond %{ENV:REDIRECT_STATUS} =401
RewriteRule ^ - [L]
Redirect
не работает с переменными, а RewriteRule
работает.&{HTTP_HOST}
, а %{HTTP_HOST}
.RewriteEngine on
<VirtualHost *:80>
RewriteEngine on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>
RewriteRule ^$ https://www.domainname.com/page [R=301,L]
RewriteEngine on
proxy_hide_header X-Frame-Options;
add_header
. set $root_path /var/www/mysite_domain_ru_usr/data/www/mydomain.ru;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
location / {
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
# не работает вариант
if ($arg_tag) {
rewrite ^/(.*)$ /$arg_tag/? permanent;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/mydomain.ru.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
set $root_path /var/www/mysite_domain_ru_usr/data/www/mydomain.ru;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
location / {
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location /category/ {
if ($arg_tag) {
rewrite ^ /category/$arg_tag/? permanent;
}
rewrite ^/([^/]+/)([^/]+)/$ /index.php?q=$1&tag=$2 last;
rewrite ^/(.+)$ /index.php?q=$1 last;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/mydomain.ru.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
location ^~ /uploads/thumbs/ {
root /home/admin/web/site-b.com/public_html;
try_files $uri @proxy;
}
location @proxy {
proxy_pass http://11.22.33.44:80$uri;
proxy_set_header Host site-a.com;
}
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site.com [OR]
RewriteCond %{HTTP_HOST} ^www.site.com [OR]
RewriteCond %{HTTP_HOST} ^www.site.net
RewriteCond %{THE_REQUEST} !^\S+\s/sub/
RewriteRule ^(.*)$ https://site.net/$1 [L,R=301]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site.com [OR]
RewriteCond %{HTTP_HOST} ^www.site.com [OR]
RewriteCond %{HTTP_HOST} ^www.site.net
RewriteCond %{REQUEST_URI} !^/sub/
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.*)$ https://site.net/$1 [L,R=301]