Top Nav

Nginx Redirects With Map File

Client provided a CSV file with several thousand redirects for site hosted on Plesk server. For maximum efficiency we implemented the redirects using a map file in Nginx.

Start by convert the CSV file to a map include file with one redirect per line, space delimited and terminated with a colon. For example:

I placed the file at:

/var/www/vhosts/acme.com/redirects/redirect.map

Next step is to add to global nginx config by creating a file at:

/etc/nginx/conf.d/redirect_maps.conf

containing:

Finally in Plesk, for the target subscription (acme.com) in “Apache & Nginx Setting” add the following to “Additional Nginx directives: