Help translating Apache RewriteRules

Chris Cortese cortese.consulting at gmail.com
Wed Apr 7 11:25:37 MSD 2010


Hello,

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;
   server_name  mysite.com.vmware;

   access_log  /usr/local/nginx/logs/mysite.com.access.log;
   error_log /usr/local/nginx/logs/mysite.com.error.log;

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

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

   location / {
     fastcgi_pass  127.0.0.1:9000;
     fastcgi_param SCRIPT_FILENAME 
/home/mylinuxuser/www/live/mysite.com/index.php;
     include /usr/local/nginx/conf/fastcgi_params;
   }
}

--------------

Can someone please advise?

Thanks!
Chris



More information about the nginx mailing list