How to redirect single URL in Nginx?

I’m in the process of reorganizing URL structure.
I need to setup redirect rules for specific URLs – I’m using Nginx.

Basically Something like this:

http://example.com/issue1 --> http://example.com/shop/issues/custom_issue_name1
http://example.com/issue2 --> http://example.com/shop/issues/custom_issue_name2
http://example.com/issue3 --> http://example.com/shop/issues/custom_issue_name3

Thanks!

Answer

location ~ /issue([0-9]+) {
    return 301 http://example.com/shop/issues/custom_isse_name$1;
}

Attribution
Source : Link , Question Author : tokmak , Answer Author : Mohammad AbuShady

Leave a Comment