By Gigi
Hi, i want to change URL from http://domain.com/?var_1=val_1&var_2=val2 into http://domain.com/val_1/val_2/ ( http://domain.com/mobile/1-first-model/ )
where to write this rule? thnx.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi! First, you’ll want to find a RegEx pattern that matches /val_1/val_2 (with an optional trailing backslash): ^/(.*?)/(.*?)/?$, then you’ll want to map val_1 and val_2 to a query string:
rewrite ^/(.*?)/(.*?)/?$ /?var_1=$1&var_2=$2&$args
&$args appends the rest of the original query string to the request, so that for example http://domain.com/val_1/val_2/?something=abcd works as expected.
Make sure you restart nginx after editing the config file.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.