JasonGenX
JasonGenX

Reputation: 5434

re-directing NGINX - what I'm doing has no effect

in my nginx condig file I'd like to make a rule so that calls to the old URL style in my site like mysite.com/airplanes/boeing are redirected (permanently) to mysite.com/categories/airplanes/boeing

rewrite ^/airplanes/$ /categories/airplanes/ permanent;

But calls to mysite.com/airplanes/boeing are still going through, hitting 404.

What am I doing wrong?

Upvotes: 0

Views: 41

Answers (1)

Alexander Azarov
Alexander Azarov

Reputation: 13221

I think you have an error in regular expression. It will match exactly /airplanes/, so will not match /airplanes/boeing.

It should be

rewrite ^/airplanes/(.*)$ /categories/airplanes/$1 permanent;

Upvotes: 1

Related Questions