title: Nginx rewrite settings
body: <p>Can anyone help me please with nginx settings</p>
  
  <p>I have a project in folder /home/test/www/project/</p>
  
  <p>This one contains:
  *.php //scripts</p>
  
  <p>css, images, videos //folders with content</p>
  
  <p>Open browser with subdomain.domain.com/project/main.php (or index.php - redirect to main.php)
  click on video, something like this subdomain.domain.com/project/main.php?v=555
  everything works well</p>
  
  <p>now i need, short links:
  subdomain.domain.com/project/555  //where 555 -get request v=555 to main.php</p>
  
  <p>i've tried:</p>
  
  <pre><code>location /project/ {
       rewrite ^/project/(.*)$ /project/main.php?i=$1 last;
  }
  </code></pre>
  
  <p>but after page refresh, i have no images or css styles, only text</p>
  
  <p>the second try:</p>
  
  <pre><code>location /project {
                  index index.php;
                  if (!-e $request_filename) {
                  rewrite ^/([^?]*)(?:\?(.*))? /project/main.php?i=$1 last;
                  }
                  if ($uri ~* "\.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$") {
                          expires max;
                          break;
                  }
  
          }
  </code></pre>
  
  <p>Without success. Any help is much appreciated</p>