【发布时间】:2017-04-07 10:44:13
【问题描述】:
我需要 nginx 通过 uri 打开文件,例如:
http://example.com/en/foo/test-bar 来自 /var/www/example.com/en_US/_foo_test_bar
或
http://example.com/en/foo2/test2-bar 来自 /var/www/example.com/en_US/_foo2_test2_bar
将除字母/数字以外的所有符号替换为下划线。应该如何看待这个位置,使用重定向可能会更好?
location /en/ {
rewrite ...
}
我不知道 nginx 和 regexp 中这种机制的最佳实践。谢谢。
【问题讨论】:
标签: regex redirect nginx url-rewriting nginx-location