1
我有例如,這網址:Nginx的 - URL重寫規則
www.example.com/folder1/folder2/edit.php?username=nickname
其實我有這樣的重寫規則:
location/{
root /var/www;
index index.php index.html index.htm;
# First rewrite rule output: www.example.com/nickname
rewrite ^/([A-Za-z0-9_]+)$ /folder1/folder2/user.php?username=$1;
# Second rewrite rule output: www.example.com/nickname/edit
rewrite ^/([A-Za-z]+)/edit$ /folder1/folder2/edit.php?username=$1;
}
但是,工作正常。
但我需要重寫我的網址是這樣的:
www.example.com/nickname/edit/info
它有幾個參數:
www.example.com/folder1/folder2/edit.php?username=nickname & info =基本
我什麼都試過,但沒有成功:
location/{
root /var/www;
index index.php index.html index.htm;
# First rewrite rule output: www.example.com/nickname
rewrite ^/([A-Za-z0-9_]+)$ /folder1/folder2/user.php?username=$1;
# Second rewrite rule output: www.example.com/nickname/edit
rewrite ^/([A-Za-z]+)/edit$ /folder1/folder2/edit.php?username=$1;
# Here where I'm stuck
# www.example.com/nickname/edit/info
rewrite ^/edit/([A-Za-z]+)/info$ /folder1/folder2/edit.php?user=$1&info=$2;
}