Hi guys,
I am new to nginx and I need to do a few rewrites, which I need help with.
I currently have this configuration:
location ~ \.php5 {
root /home/$username/www/;
rewrite ^/(.*)\.php5 /$1.php permanent;
}
The problem with this is that it rewrites the files, also if they are in subfolders - and this is what I do not want.
I have a root folder and inside it there is a folder called wiki/.
php5 files from inside one of these two folders should get rewritten to php files.
E.g. the file /api.php5 should get rewritten to /api.php.
File /wiki/load.php5 should get rewritten to /wiki/load.php.
But file /wiki/some-subfolder/file.php5 should *not* get rewritten, because it is neither in the root folder nor in wiki/ directly, but in one of the subfolders of wiki. Files from subfolders should *not* get rewritten.
How can I get that?
Joerg