【发布时间】:2018-06-21 15:42:06
【问题描述】:
我要重写网址
https://www.beecow.info/product/whosaler-san-pham-shop-dang-590-34-390-k-p345954
到 https://www.beecow.info/whosaler-san-pham-shop-dang-590-34-390-k-p345954
我想删除 /product/ 这是我的 nginx 配置
server {
listen 80;
server_name beecow.info;
return 301 https://www.beecow.info$request_uri;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name www.beecow.info localhost;
root /var/www/html/;
# Load configuration files for the default server block.
#include /etc/nginx/default.d/*.conf;
if ($http_x_forwarded_proto != "https") {
rewrite ^(.*)$ https://$server_name$1 permanent;
}
location ~* ^/product/(.*){
rewrite ^/product/(.*)$ /$1 last;
}
location / {
try_files $uri$args $uri$args/ /index.html;
}
但它不能工作。网址不再改变。
【问题讨论】:
-
请给我一些建议。非常感谢您的帮助
标签: .htaccess nginx url-rewriting nginx-location