nginx rewrite rules tutorial August 01, 2013 / Updated: June 12, 2022
Rewrite rules for Zenphoto 1.4.5+
Nginx rules for Zenphoto 1.4.5 have been greatly simplified. In your server { } block, add:
location / { try_files $uri $uri/ /index.php?$args; }
Or for a subdirectory:
location /subfolder { try_files $uri $uri/ /subfolder/index.php?$args; }
To redirect URLs that do not end in a slash, add this inside the location block above (optional):
rewrite ^([^\.]*[^/])$ $1/ permanent;
Rewrite rules for older releases:
This text by www.zenphoto.org is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Code examples are released under the GPL v2 or later license
For questions and comments please use the forum or discuss on the social networks.