-1

I am trying to understand how to get this location block to work as desired.

## TESTING MOD REWITE FROM APACHE...
location /beta9/projects/project/ {
    try_files $uri $uri/ /beta9/projects/project/index.php?$args;
    fastcgi_pass   php_processes;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    include        fastcgi_params;

}

How can I take the following URL

MASKED URL

http://localhost/beta9/projects/project/574

..and process it as...

RAW URL

http://localhost/beta9/projects/project/?project_id=574

As you can see, these url parameters do not get passed and the php page breaks.

0

Alright. First of all thank you for the downvote as it inspired even more research on my part. Once you grow tired of searching for this answer on stackoverflow and serverfault, remember to bookmark the one with 1 or more downvotes and no feedback what-so-ever. It is ironically the one.

The following single line of code worked as a solution.

## REWRITE - SEGMENT TO PARAMETER Coversion
location ~ /beta9/projects/project/ {
    rewrite ^/beta9/projects/project/(\d+)$ /beta9/projects/project/index.php?project_id=$1 last;
}

It would be really nice to at least get some feedback on if there's any redundancy in this solution and if there's a more elegant way of doing it.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.