我試圖從重定向 https://support.example.com.br/ 為 https://support.example.com.br/?SSO=1
我如何通過 nginx 做到這一點?我的代碼是這樣的:
server {
listen 8080;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
rewrite ^/$ /?SSO=1$1 redirect;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(. \.php)(/. )$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SERVER_NAME $host;
}
location ~ /\.ht {
deny all;
}
location ~ php-errors\.log$ {
deny all;
}
}
uj5u.com熱心網友回復:
server {
...
rewrite ^/$ /?SSO=1 permanent;
}
uj5u.com熱心網友回復:
請不要問關于同一個問題的第二、第三等問題。使用評論系統來澄清您對特定答案的問題。要SSO在請求中已指定查詢引數時防止重定向,請嘗試以下操作:
server {
... # global server block directives
if ($arg_SSO = '') {
rewrite ^/$ /?SSO=1 permanent;
}
... # your locations goes here
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/376070.html
上一篇:Nginxtryfiles回退跳過不存在的php檔案
下一篇:Nginx不壓縮網頁
