301 redirect

JACK LINKERS jacklinkers at gmail.com
Sat Feb 14 21:57:26 UTC 2015


I need to redirect some URLs after redesigning my website.
I use a 301 redirect for HTTP to HTTPS protocole :

if ($scheme = "http") {
return 301 https://$server_name$request_uri;

But how do I redirect URLs that have been changed ?
ie. https://mywebsite.com/oldname.html to https://mywebsite.com/newname.html

I did try

   if ( $request_filename ~ oldname.html/ ) {
      rewrite ^ https://mywebsite.com/newname.html/? permanent;

But this doesn't work.

My website is hosted on a server with Direct Admin runing on a CentOS with
Nginx as webserver. Don't know if it helps.

Thanks in advance for help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150214/4a1ad98a/attachment.html>

More information about the nginx mailing list