J'ai par exemple l'adresse suivante:Nginx - Réécriture URL Règles
www.example.com/folder1/folder2/edit.php?username=nickname
En fait, j'ai ces règles de réécriture :
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;
}
Cependant, cela fonctionne très bien.
Mais je dois réécrire mon URL comme ceci:
www.example.com/nickname/edit/info
Il a deux paramètres:
www.example.com/folder1/folder2/edit.php?username=nickname & info = de base
J'ai tout essayé, mais sans succès:
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;
}