title: Nginx rewrite rules are not working as expected
body: <p>I have a website 
  <code>https://dev.mywebsite.com/index.php?album=portraits</code>
  which displays photo-albums dynamically based on a POST value. </p>
  
  <p>I want to rewrite this URL to this:
  <code>https://dev.mywebsite.com/portraits</code></p>
  
  <p>But my Nginx rewrite rule is not working. Nothing is happening when I enter <code>https://dev.mywebsite.com/index.php?album=portraits</code>. And no page is found when entering <code>https://dev.mywebsite.com/portraits</code>.</p>
  
  <p>I don't know what I am doing wrong. </p>
  
  <p>This is the code I'm trying to use currently: </p>
  
  <pre><code>location / {
          rewrite ^/(.*)$ /album.php?album=$1 last;
  }
  </code></pre>
  
  <p>I've also tried this: </p>
  
  <pre><code>location = /portraits { 
          rewrite ^/portraits?$ /index.php?album=portraits break; 
  }
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>location = /album { 
          rewrite ^album/([a-z]+)/?$ album.php?album=$1 break; 
  }
  </code></pre>
  
  <p>This is the entire nginx site-config file i'm using:</p>
  
  <pre><code>server {
          listen 80 default_server;
          listen 443 ssl;                                         
          root /config/www;
          index index.php index.htm index.html;
          server_name dev.mywebsite.com;
  
          ssl_certificate /config/keys/cert.crt;
          ssl_certificate_key /config/keys/cert.key;
  
          client_max_body_size 0;
  
          location / {
                  try_files $uri $uri/ /index.html /index.php?$args =404;
          }
      location / {
                  rewrite ^/(.*)$ /album.php?album=$1 last;
          }
  
      location ~ \.php$ {
                  #fastcgi_split_path_info ^(.+\.php)(/.+)$;
                  # With php5-cgi alone:
                  fastcgi_pass 127.0.0.1:9000;
                  # With php5-fpm:
                  #fastcgi_pass unix:/var/run/php5-fpm.sock;
                  fastcgi_index index.php;
                  include /etc/nginx/fastcgi_params;
  
          }
  }
  </code></pre>