Welcome! Log In Create A New Profile

Advanced

Re: Redirecting existing links to a sub-folder to a new subdomain

Francis Daly
February 22, 2015 10:50AM
On Sun, Feb 22, 2015 at 03:30:58AM -0500, codecowboy wrote:

Hi there,

> If I want to transform links from
> http://exampledomain.com/sub-folder/some-article to
> http://subdomain.exampledomain.com/some-article where subdomain has the same
> name as the subfolder, do I need a rewrite or a redirect? I *think* I need a
> redirect but want to be sure I am doing it the recommended way.

You need to issue a http redirect.

You can do that using the nginx directive "rewrite" or the nginx directive
"redirect" (among other ways).

> I tried "rewrite /sub-folder-name/(.*)
> $scheme://sub-folder-name.exampledomain.com/$1 permanent;"

That can work, depending on where exactly it is written.

> But this didn't seem to have any effect after restarting nginx.

What do the logs show? "Nothing" suggest one kind of fix; "something"
suggests another, depending on what the "something" is.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Redirecting existing links to a sub-folder to a new subdomain

codecowboy February 22, 2015 03:30AM

Re: Redirecting existing links to a sub-folder to a new subdomain

Francis Daly February 22, 2015 10:50AM

Re: Redirecting existing links to a sub-folder to a new subdomain

codecowboy February 22, 2015 01:27PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 311
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready