location = / {
rewrite ^$ router/;
}
/
не совпадает с шаблоном ^$
.location / {
rewrite ^(.*)$ router/$1 break;
}
location /router {
try_files $uri $uri/ /router/index.php;
}
location /router
location / {
try_files /router$uri /router$uri/ /router/index.php;
}
root /home/vadosiq/server/public_html/router;
location / {
try_files $uri $uri/ /index.php;
}
*.lulzslab.ru
.Name-based virtual hosts for the best-matching set of <virtualhost>s
are processed in the order they appear in the configuration. The first matching ServerName or ServerAlias is used, with no different precedence for wildcards (nor for ServerName vs. ServerAlias).
ServerAlias: *.lulzslab.ru
если он окажется подлючён раньше файла dream.lulzslab.ru.conf.Include sites-enabled/*conf
httpd.apache.org/docs/2.4/mod/core.html#includeShell-style (fnmatch()) wildcard characters can be used in the filename or directory parts of the path to include several files at once, in alphabetical order.
*.lulzslab.ru
в настройках основного домена. RewriteRule ^(pages|confirm|captcha|listing|api|search|account|banlist|cabinet|servers|payment_gateway|admin_[^/]+)(/.*)?$ /monitoring/$0 [L]
RewriteRule ^api/?$ /?module=api [L]
/?module=api
так запрос будет отправлен в корень сайта.?module=api
так запрос останется в /monitoring/.RewriteEngine On
#Вызов страницы 404
ErrorDocument 404 /monitoring/?404
#Динамические страницы
RewriteRule ^pages/([^/]+).htm$ ?module=pages&url=$1 [L]
#Сброс пароля
RewriteRule ^confirm/([^/]+)/$ ?module=password_reset&confirm=$1 [L]
#Каптча
RewriteRule ^captcha/?$ ?module=captcha [L]
#Листинг
RewriteRule ^listing/?$ ?module=listing [L]
#API
RewriteRule ^api/?$ ?module=api [L]
#Поиск
RewriteRule ^search/?$ ?module=search [L]
#Авторизация, регистрация и тд.
RewriteRule ^account/([a-z]+)/?$ ?module=account&action=$1 [L]
#Банлист
RewriteRule ^banlist/?$ ?module=banlist [L]
#Кабинет
RewriteRule ^cabinet/?$ ?module=cabinet [L]
RewriteRule ^cabinet/([a-z]+)/?$ ?module=cabinet&action=$1 [L]
#Страница сервера
RewriteRule ^servers/([0-9.:]*)/([a-z]+)/?$ ?module=servers&ip=$1&action=$2 [L]
#Модуль принятия оплаты
RewriteRule ^payment_gateway/([a-z]*)/([a-z]*)?/$ ?module=payment_gateway&gateway=$1&action=$2 [L]
#Админка
RewriteRule ^admin_([^/]+)/$ ?module=admin_$1 [L]
RewriteRule ^admin_([^/]+)/([a-z]+)/?$ ?module=admin_$1§ion=$2 [L]
RewriteRule ^admin_([^/]+)/([a-z]+)/([0-9]+)/?$ ?module=admin_$1§ion=$2&id=$3 [L]
RewriteRule ^admin_([^/]+)/([a-z]+)/([0-9a-z_]+)/?$ ?module=admin_$1§ion=$2&subsection=$3 [L]
/
в конце./.well-known/acme-challenge/
, то довольно странно ожидать что он сработает для /.well-known/acme-challenge
./
в конце.location ^~ /.well-known/acme-challenge {
perl_set $var '
sub {
open(my $fh, "<", "/path/to/my.conf") || return "default value";
my $data = <$fh>;
close($fh);
return $data;
}
';
server {
...
proxy_set_header whatever $var;
...
}
/?
Modifying the Query String
By default, the query string is passed through unchanged. You can, however, create URLs in the substitution string containing a query string part. Simply use a question mark inside the substitution string to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark.
.html/
, но и всего остального что оканчивается на /
.<base href="http://site.ru/">
Redirect
это директива mod_aliasRedirect 301 /pages/articles /articles
/pages/articles -> /articles
/pages/articles/100 -> /articles/100
/pages/articles/ab/bc -> /articles/ab/bc
RewriteRule ^(.*)$ index.php?query=$1 [QSA,L]
=
или !=
рассматривается как обычная строка и проверяется точное совпадение с этой строкой. Поэтому не работает RewriteCond %{REQUEST_URI} !=^/pages/articles/(.*)$
RewriteCond %{REQUEST_URI} !^/pages/articles/(.*)$
.RewriteRule ^pages/articles$ /articles [R=301,L]
RewriteRule ^pages/about$ /about [R=301,L]
RewriteRule ^news\.php$ /news [R=301,L]
m
включает многострочный режим, который влияет только на якорные метасимволы ^ $
.server {
listen 80;
server_name new.prodject.ru;
return 301 https://$host$request_uri;
server {
listen 443 ssl;
server_name new.prodject.ru;
^([^.]+)\.video$
rewrite ^([^.]+)\.video$ $1.html;
location ~ ^([^.]+)\.video$ {
try_files $1.html =404;
}