【发布时间】:2019-05-17 22:55:40
【问题描述】:
我正在尝试从请求的 html 文件重定向到特定位置。
例如:
来自
https://example.com/cars/description/ferrari-1-1532.html
到
https://example.com/car/catalog/ferrari.html
我试过这个配置
location /cars/description/*.html {
rewrite ^(.*)$ https://examples.com/car/catalog/request_filename redirect;
}
但它不起作用。
【问题讨论】:
-
如何确定具体的URI?它总是第一个词吗?还是您需要一张地图来翻译每个单独的链接?
标签: regex linux nginx url-rewriting