Rewrite help when files do NOT have a ".php" extension

pk899 nginx-forum at
Wed Jun 1 18:03:01 MSD 2011

Sorry edogawan. That was funny :) 

Appa, yes I agree, it is much clearer with the blocks now making sense.

NOT working though. I will deal with Wordpress etc later. Want my root
folder stuff to work first. Here are my simple rules. 

   location / {
      rewrite   ^/([-~a-zA-Z0-9_\.]+)$        /site/get?u=$1; 
    location /site {

        location /site/get {
          fastcgi_pass    unix:/dev/shm/php5-fpm.MYDOMAIN.sock;
          include         fastcgi_params;
          fastcgi_param   SCRIPT_FILENAME  
          fastcgi_param   PATH_TRANSLATED  
          fastcgi_param   SCRIPT_NAME       $fastcgi_script_name;
       try_files $uri $uri/ /site/get?u=$uri  =404; 



(1) What am I missing here? The "fastcgi_params" is a file that has the
usual bits and pieces. 

(2) Will a more precise regexp like above be faster, or should i leave
it as "(.*)"? 


Posted at Nginx Forum:,202956,202993#msg-202993

More information about the nginx mailing list