I have the following rewrite rules for nginx.
The rules seem to not function correctly, for example the rule for games is supposed to rewrite http://thegamesdb.net/game/2/
to http://thegamesdb.net/index.php?tab=game?id=2
hover when I navigate to /game/2/ the browser is downloading a file called simply download
.
My rewrite rules are as follows:
# nginx configuration
location /game {
rewrite ^/game/([0-9]+)(/?)$ /index.php?tab=game&id=$1 break;
rewrite ^/game-edit/([0-9]+)(/?)$ /index.php?tab=game-edit&id=$1 break;
}
location /search {
rewrite ^/search/([a-z0-9\-\ /\+]+)(/?)$ index.php?tab=listseries&string=$1&function=Search break;
rewrite ^/search(/?)$ /index.php?tab=listseries&function=Search break;
}
location /browse {
rewrite ^/browse/([0-9+]*)(/?)$ /index.php?tab=listplatform&stringPlatform=$1&function=Browse+By+Platform break;
}
location /platform {
rewrite ^/platform/([0-9]+)(/?)$ /index.php?tab=platform&id=$1 break;
rewrite ^/platform/([a-z0-9\-]+)(/?)$ /index.php?tab=platform&alias=$1 break;
rewrite ^/platform-edit/([0-9]+)(/?)$ /index.php?tab=platform-edit&id=$1 break;
}
location /favorites {
rewrite ^/favorites(/?)$ /index.php?tab=favorites break;
}
location /message {
rewrite ^/message/([0-9]+)(/?)$ /index.php?tab=message&messageid=$1 break;
}
location /adminstats {
rewrite ^/adminstats/([a-z0-9\-]+)(/?)$ /index.php?tab=adminstats&statstype=$1 break;
}
location /blog {
rewrite ^/blog(/?)$ /blog/ break;
}
location /wiki {
rewrite ^/wiki(/?)$ /wiki/ break;
}
location /forums {
rewrite ^/forums(/?)$ /forums/ break;
}
location /phpmyadmin {
rewrite ^/phpmyadmin(/?)$ /phpmyadmin/ break;
}
location / {
rewrite ^/([a-z0-9\-\ /\+]+)(/?)$ index.php?tab=$1 break;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
}
I can't see what is wrong with the rules, am I missing something?
By the way, I'm using Ajenti-V and the rules above are enetered into the custom config panel of the Ajenti-V website.
Update:
It seems that my current re-write rules need to be routing through to php-fpm
as they are currently being treated as just a static file.
How would I adapt the code above to accomplish this?