admin管理员组文章数量:1323739
I am using PHP based application in which i need to configure Nginx. I wanted to forward only path / to /?product_cat=top and all other request will remains same.
below is my Nginx configuration:
server {
server_name default_server;
listen 80;
root /var/www/wordpress;
underscores_in_headers on;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH';
add_header Allow "GET, POST, HEAD, OPTIONS, PATCH" always;
access_log /var/log/nginx/ecom.log json;
error_log /var/log/nginx/ecom-error.log;
index index.php index.html index.htm ;
location = / {
return 301 /?product_cat=top;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
}
I tried above but its giving too many redirection errors.
本文标签: phpHow to route root pathto xyz in nginx
版权声明:本文标题:php - How to route root pathto xyz in nginx? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742121546a2421729.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论