Issues

ZF-7701: Nginx rewrite rules for reference guide

Issue Type: Docs: Improvement Created: 2009-08-27T07:55:51.000+0000 Last Updated: 2012-11-06T19:40:36.000+0000 Status: Open Fix version(s): Reporter: Markus Pointner (mooware) Assignee: Jordan Ryan Moore (jordanryanmoore) Tags: - Zend_Controller

  • zf-caretaker-adamlundrigan

Related issues: Attachments:

Description

In the reference guide, chapter 12.5. "The Standard Router", there are rewrite configurations for Apache HTTP Server, Lighttpd and IIS. I think there should also be an example for rewrite rules for the Nginx web server. I have already written such a configuration and it works well on my server.

<pre class="highlight">
if (!-e $request_filename) {
  rewrite ^.*$ /index.php last;
}

I translated it from the extended Apache mod_rewrite example, I'm quite sure it works the same.

Comments

Posted by Evan Coury (evan.pro) on 2012-02-06T20:21:38.000+0000

Per the nginx wiki, you should avoid using if()'s in nginx configurations if at all possible. The proper way to do this is:

<pre class="literal">
try_files $uri $uri/ /index.php?$args;

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts