Regular Expression to fix broken URL’s in Nginx

Morning all,

On my previous server that ran apache I had some htaccess rules that helped forward a certain pattern of URL’s which were giving 404’s to the fixed pattern.

Long time ago my URLS for my site were http://domainname/articlename and then I changed it to be http://domainname/category/articlename

Now the problem is the older links that google has are returning 404’s and I want to intercept any URL that doesn’t have a category and insert a fake category and then my wordpress installation can resolve the URL.

So I’m looking for a nginx solution to this problem which I presume will be in the config file somewhere that will take this URL (which gives a 404)

and change it to

which then resolves properly.

Read more here: Regular Expression to fix broken URL’s in Nginx

Leave a Reply

Your email address will not be published. Required fields are marked *