News & Announcements, Tutorials/Tips

Guide to writing NGINX rewrite rules

Looking for a definitive guide to crafting Nginx rewrite rules?

Today is your lucky day!

The folks at Nginx have published just what you’re looking for. It’s title Creating NGINX Rewrite Rules and it begins with:

Rewrite rules change part or all of the URL in a client request, usually for one of two purposes:

  • To inform clients that the resource they’re requesting now resides at a different location. Example use cases are when your website’s domain name has changed, when you want clients to use a canonical URL format (either with or without the www prefix), and when you want to catch and correct common misspellings of your domain name. The return and rewrite directives are suitable for these purposes.
  • To control the flow of processing within NGINX and NGINX Plus, for example to forward requests to an application server when content needs to be generated dynamically. The try_files directive is often used for this purpose.

We’ll assume you’re familiar with the HTTP response codes and with regular expressions (NGINX and NGINX Plus use the Perl syntax). Continue reading.

Nginx logo

Subscribe to

Subscribe to receive the latest articles in your Inbox

Trust me, you'll not be spammed...

Please share:

We Recommend These Vendors and Free Offers

Register now for Blockchain & Cryptocurrency Con 2018, international conference on blockchain technnology in Dallas, TX (USA), Feb. 23-24, 2018. A 50% discount for students.

Best WhatsApp Plus features in Gbwhatsapp latest APK download

Best binary auto trading software reviews by

Google has got competition, because Presearch is building a blockchain-based search engine controlled by the community. At $0.15 a token, you can participation in Lot 3 of the token sale by clicking here

Open Money is building a solution that will run mainstream software on blockchain tech. Click here to get free tokens that will be the digital currency of the platform

Launch an SSD VPS in Europe, USA, Asia & Australia on Vultr's KVM-based Cloud platform starting at $5:00/month (15 GB SSD, 768 MB of RAM).

Leave a Comment

Your email address will not be published. Required fields are marked *