Nginx rewrite rules when using "pretty" URLs (Read 4082 times)

Started by Nightwish, July 13, 2012, 18:46:07

0 Members and 1 Guest are viewing this.
Share this topic:
New #1
Nginx rewrite rules when using "pretty" URLs |
July 13, 2012, 18:46:07
This is a note to myself, just verifying that pretty URLs work with these rewrite rules:
location /forum/ {
  if (!-e $request_filename) {
    rewrite ^/forum/(.*)$ /forum/index.php?q=$1 last;
Note: /forum/ must be set accordingly to the board's URL.

Tested on Nginx 1.2.1 / PHP 5.4.4 (fastcgi via php-fpm).

Note: this should also work for default SMF with the SimpleSEF plugin, since pretty URLs in EoS are based on SimpleSEF and use the same URL scheme.
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork
1 Thank You  | 1 Useful 
Last Edit: July 15, 2012, 15:02:12 by Nightwish