URL re-writing with nginx, PHP, and WordPress

There are many posts about nginx, re-directs, PHP, and WordPress. There are somewhat fewer posts that talk about (internal) re-writes, where the request by the web browser is mangled to be served by another resource than the one requested.

For example, I may want a request for https://mysite.foo/cool/penguin to actually be served by https://mysite.foo/coolstuff.php?id=penguin, or simply setup an alias such as https://mysite.foo/cool/penguin to be served by https://mysite.foo/cool/linux, but preserve the URL in the browser address bar.

With PHP-FPM and nginx, you run into an additional problem, which is the fastcgi_parm variables that are passed from nginx to PHP-FPM. So even if you have really fancy URL re-writing configured (and working), the end result may not be passed on to PHP-FPM from nginx.

So solve this, you should look into this construct, which is present in many nginx configurations as a default setup:

fastcgi_param REQUEST_URI $request_uri;

Since your needs probably differ from mine, I wont make this post any longer than it has to be, but that fastcgi_param line above may be a good starting point if you’re experiencing problems with nginx, PHP-FPM, and URL re-writing.

Good luck!

When Gimp 2.8 gets confused about Single-Window Mode

Using Gimp 2.8 and Single-Window Mode under Ubuntu 12.04.LTS + Gnome, I ran into somewhat of a snag today. No matter what I did, I could not get the tool palette to integrate into Single-Window Mode. I toggled the Single-Window setting to no avail. Re-starting Gimp didn’t yield any improvements. There was, however, a simple solution.

Make sure Gimp is not running. From a terminal, go to your home directory and then .gimp-2.8 (~/.gimp-2.8). Remove the two files sessionrc and  toolrc. Re-start Gimp, toggle the Single-Window Mode setting, and make sure it’s ON  (it’s under the “Windows” menu). Note, this is applicable to Gimp 2.8 and above.

Limiting the number of revisions in WordPress

Tired of nine zillion revisions of your posts created on your WordPress site?

Open up wp-config.php with a nice editor like Emacs or Pico/Nano or VI and add:

define('WP_POST_REVISIONS', false );

to disable post revisions completely.

Or, if you just want to limit the number of revisions WordPress keeps:

define('WP_POST_REVISIONS', 3);


Of course, this is just a simple Google query away from you:

Or, as it happens: