我想在我的nginx服务器中使用重写功能.
当我尝试" http://www.example.com/1234 "时,我想重写" http://www.example.com/v.php?id=1234 "并希望获得" http:// www .example.com/1234 "在浏览器中.
这是nginx.conf文件
...
location ~ /[0-9]+ {
rewrite "/([0-9]+)" http://www.example.com/v.php?id=$1 break;
}
...
Run Code Online (Sandbox Code Playgroud)
当我尝试" http://www.example.com/1234 "时
我想要 ...
url bar in browser : http://www.example.com/1234
real url : http://www.example.com/v.php?id=1234
Run Code Online (Sandbox Code Playgroud)
但我遇到了麻烦......
url bar in browser : http://www.example.com/v.php?id=1234
real url : http://www.example.com/v.php?id=1234
Run Code Online (Sandbox Code Playgroud) typedef struct Edge
{
int v1, v2, w;
bool operator <(const Edge &rhs) const{
bool b = v1 < rhs.v1 || v2 < rhs.v2;
return (b);
}
} edge;
template <class T>
struct my_less
{
bool operator()(const T& _Left, const T& _Right) const
{
return (_Left < _Right);
}
};
int main(int argc, char *argv[])
{
set <edge, my_less<edge> > F;
edge e3 = { 3, 3, 3};
edge e4 = { 3, 7, 3};
edge e5 = { 2, …Run Code Online (Sandbox Code Playgroud)