Help translating Apache RewriteRules

Chris Cortese at
Wed Apr 7 11:25:37 MSD 2010


I've been using nginx for 1.5 years now with about 10 or so CodeIgniter 
sites, but apparently I still haven't mastered the rewrite stuff.

With the CodeIgniter stuff (and Igor's help), I never had to use the 
"rewrite" command at all.

Anyway, now I need to translate the following (from .htaccess for Apache):

RewriteRule ^([0-9a-zA-Z\/\-\_\@]+)$ index.php?demand=$1 [QSA,L]

My current conf file is going into a loop and eventually returning nothing:

server {
   listen 80;

   access_log  /usr/local/nginx/logs/;
   error_log /usr/local/nginx/logs/;

   root /home/mylinuxuser/www/live/;
   index index.php;

   rewrite ^/([0-9a-zA-Z\/\-\_\@]+)$ /index.php?demand=$1 last;

   location / {
     fastcgi_param SCRIPT_FILENAME 
     include /usr/local/nginx/conf/fastcgi_params;


Can someone please advise?


More information about the nginx mailing list