I am having this issue with an external platform which trying to get rest urls from my magento 2.4.5.
Issue is that the urls they hit contain
index.php
inside. They are like this:
https://example.com/en_us/index.php/rest/V1/customerGroups/search?searchCriteria%5BcurrentPage%5D=1&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bcondition_type%5D=gteq&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=id&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=0&searchCriteria%5BpageSize%5D=50
As you see inside the url is included
index.php
I use nginx as web server and although I have this rule:
try_files $uri $uri/ /index.php$is_args$args;
which should strip index.php from url, for some reason in rest urls it doesn’t work
And this gives 404 Not found
So I am trying to remove the index.php from rest urls
I inserted this additional rule in nginx:
location /api/ {
rewrite ^index.php/rest/(.*)$ https://%example.com/rest/$1;
}
But no luck.
Any help please?