Welcome! Log In Create A New Profile

Advanced

Re: 301 redirect

February 14, 2015 05:32PM
Hi Francis,

Thanks for your input. What would be the best ways doing it then ?
(I forgot to mention there is a large amount of URLs : +/- 20)

Is this a good way ? :

map $old $new {
oldlink.html newlink.com
oldink2.html newlink2.html
}

location $old {
return 301 $scheme://$host$new;
}

If not, could you show me an example ?

Thanks in advance


2015-02-14 23:22 GMT+01:00 Francis Daly <francis@daoine.org>:

> On Sat, Feb 14, 2015 at 10:57:26PM +0100, JACK LINKERS wrote:
>
> > But how do I redirect URLs that have been changed ?
> > ie. https://mywebsite.com/oldname.html to
> https://mywebsite.com/newname.html
>
> location = /oldname.html { return 301 /newname.html; }
>
> > I did try
> >
> > if ( $request_filename ~ oldname.html/ ) {
> > rewrite ^ https://mywebsite.com/newname.html/? permanent;
> > }
> >
> > But this doesn't work.
>
> Yes, it does. If your incoming request matches the string "oldname.html/".
>
> It just isn't a very good way of implementing it.
>
> f
> --
> Francis Daly francis@daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

301 redirect

shiroweb February 14, 2015 04:58PM

Re: 301 redirect

Ian February 14, 2015 05:20PM

Re: 301 redirect

Francis Daly February 14, 2015 05:24PM

Re: 301 redirect

shiroweb February 14, 2015 05:32PM

Re: 301 redirect

Francis Daly February 14, 2015 05:40PM

Re: 301 redirect

shiroweb February 14, 2015 05:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 254
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