Can you please help me to write rewrite rule for ngnix :
Actual URL : http://www.example.com/all-dog-breeds.php?Greater-Swiss-Mountain-Dog/82 expected URL : http://www.example.com/Greater-Swiss-Mountain-Dog/82
I tried below rewrite URL but it is not working:
rewrite ^/([A-Za-z-]+)/([0-9]+)/?$ /all-dog-breeds.php?$1/$2; rewrite ^/(.*)/(.*)$ /all-dog-breeds.php?$1/$2 last;
Advertisement
Answer
The regex you’re actually looking for is: https://regex101.com/r/uC1wH6/3
I believe that should be converted into Apache as follows:
rewrite ^/[^/]*?(.*)$ /$1