Zend Framework

Nginx rewrite rules for reference guide

Details

  • Type: Docs:  Improvement Docs: Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Zend_Controller
  • Labels:
    None
  • Language:
    English

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.

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.

Activity

Hide
Evan Coury added a comment -

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

try_files $uri $uri/ /index.php?$args;
Show
Evan Coury added a comment - Per the nginx wiki, you should avoid using if()'s in nginx configurations if at all possible. The proper way to do this is:
try_files $uri $uri/ /index.php?$args;

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: