Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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) {
  break;
  }
  if (-d $request_filename) {
  break;
  }
  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 "x.com/y" to "x.com/script.php?id=y" for all external links that I post.

The Wordpress link setup right now has almost all internal links begin with "news" (x.com/news/post-blah, x.com/news/category/1, etc) BUT I also have a few root links that point to some internal content (x.com/news, x.com/start). 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 "x.com/news" and "x.com/news/" 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
add comment

1 Answer 1

The official wiki has quite an elaborate example on configuring wordpress: http://wiki.nginx.org/Wordpress

share|improve this answer
add comment

Your Answer

 
discard

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