Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Okay so I installed Nginx/PHP/MySQL/Wordpress via a online walk through, and it had me enter these rewrites to enable Wordpress pretty URLs:

  if (-f $request_filename) {
  if (-d $request_filename) {
  rewrite ^(.+)$ /index.php?q=$1 last;

  error_page  404  = //index.php?q=$uri;

This is then included in the vhost for my domain. What I'm trying to do now is add some redirection/link shortner rewrites that will play nice with the setup I have in mind. I'd like to redirect "" to "" for all external links that I post.

The Wordpress link setup right now has almost all internal links begin with "news" (,, etc) BUT I also have a few root links that point to some internal content (, I'm guessing that's going to cause some conflicts. What's the best approach to do this? I've never worked with Nginx (or any rewrite rules) but maybe I can distinguish between "" and "" to allow it to play nice?

I had a friend setup a working version of this in Apache and it'd be nice if I could get this up on Nginx again.

share|improve this question

The official wiki has quite an elaborate example on configuring wordpress:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.