제대로 쿼리 유형에 대한 위치 및 재 작성로 만들려면 Nginx에 위치
site.com/b/?g=qwerty
재 작성 :
/b/?g=qwerty
요청 :
site.com/anyshorttext/?h=qwerty
재 작성 :
server {
location ~ /a/?(.*)$ {
rewrite ^/([-\w]+) /a/?m=$1 break;
index index.php index.html index.htm;
try_files $uri $uri/ =404;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
}
location ~ /b/?(.*)$ {
rewrite ^/([-\w]+) /b/?m=$1 break;
index index.php index.html index.htm;
try_files $uri $uri/ =404;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
}
location ~* ^/[a-zA-Z0-9/_$/]+$ {
rewrite ^/([-\w]+) /special/?h=$1 break;
index index.php index.html index.htm;
try_files $uri $uri/ =404;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
}
}
:
/special/?h=qwerty
내가이 솔루션을 적용그러나이 경우 요청은
/special/에만 전달됩니다.
고맙습니다.
'?'다음에 오는 것은 모두 쿼리 문자열이며'rewrite' 및'location' 지시어에서 사용하는 정규화 된 URI의 일부가 아닙니다. 요구 사항 :'/site/a/? f = qwerty' ~'/ a /? f = qwerty'는 NOP입니다. –
예제는 각 경우에 대해 쿼리 문자열이 변경되지 않는다는 것을 의미합니다. 그것이 사실이라면, 나는 당신을위한 해결책을 가지고있다. –