我对nginx非常陌生,只是在使用重写规则。
我想要我的域名http://example.com/database/view.php?id=1
显示为http://example.com/database/id/
当GET参数显示在url中的"id“位置时,这是可能的吗?
我已经尝试过了:
rewrite ^/database/$arg_id? /database/view.php?id=[1-9]* last;
和
location @database {
rewrite ^/view/(.*) /view.php?id=$1&$args last;
}它们失败了,导致example.com/database/view/51作为404
发布于 2015-02-19 13:49:08
修复:)
已解决
rewrite ^/view/(.*)/ /database/view.php?id=$1&$args last;
https://stackoverflow.com/questions/28597844
复制相似问题