Redirect Question for Directory Structure Change

figshta nginx-forum at forum.nginx.org
Wed Sep 9 15:11:53 UTC 2020


I'm looking for help with a permanent site-wide redirect.

I have a website that I moved to a new server. 
For some crazy reason the old server had an odd structure that I am
changing.
The URL root  for the old site is http://threedaystubble.com/e/
I have changed it to be http://threedaystubble.com/

Example:
threedaystubble.com/e/gallery.html --- redirects to ---->
threedaystubble.com/gallery.com

There are many other folders and html files that need this site-wide
redirect. 

Of course anyone can access the site when linking to the root, but there are
many links out there referring to the old directory structure under /e/.
I'm looking for assistance writing a redirect so all those inbound links out
there on the internet work again.

I tried a couple of ideas, but they didn't work,
I thought this location directive inside a server block was best, but it
didn't work. 

location = /e {
       return 310 $scheme://threedaystubble.com;
} 

Any help would be greatly appreciated.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,289363,289363#msg-289363



More information about the nginx mailing list