Redirecting problem

Please use this template for troubleshooting questions.

My issue: I am trying to redirect traffic to a folder on one of my websites to another. I have replaced the code in the problem folder with a single index.php file to redirect, but anything other than a raw folder name in the url comes back as file not found.

How I encountered the problem: My site https://myhomecloud.uk has a copy of phpgedview below it and I have now switched the content to be using webtrees instead.

Solutions I’ve tried: I thought this should be easy and have added a rewrite to generic bitweaver rewrite block

rewrite ^/phpgedview(/.*)?$ /phpgedview/index.php last;
The rest of the rewrites work fine for the other packages it is only this one which is not playing ball. I have also added
location /phpgedview/ {
try_files $uri $uri/ /phpgedview/index.php;
}
to the site vhost.conf file with little luck. I did try a little hack and linked the index.php file to ones now appearing in the error.log file, so /phpgedview/descendancy.php which at one point worked, currently is not, just giving ‘file not found’ which should have triggered the try_files?

Version of NGINX: 1.29.5

Deployment environment: PHP 8.4.18 - phpinfo()

Minimal NGINX config to reproduce your issue (preferably running on https://tech-playground.com/playgrounds/nginx for ease of debugging, and if not as a code block): How do I do that for one of the vhosts? I have several sites all sharing common conf.d blocks and on the whole forwarding correctly.

NGINX access/error log: /phpgedview/descendancy.php is showing in access and error logs

OK answering my own problem now that the ‘AI’ is giving different answers :wink:
I’m missing ~ ^ in the location block, and of cause the rewrite is redundant but I still do not see why that was not working initially?

I’ve tidied things a little so that currently what is working is
location ~ ^/phpgedview/ {
try_files $uri $uri/ /phpgedview.php;
}

So I’ve removed the phpgedview folder completely and moved the redirecting index file to one with it’s own name. That seems to be the tidy was of doing things …