How can I create 301 redirect for Nginx?

Refers to:

  • Plesk 11.5 for Linux
  • Plesk 12.0 for Linux

Created:

2016-11-16 12:53:54 UTC

Modified:

2016-12-21 19:28:54 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How can I create 301 redirect for Nginx?

Symptoms

How can I create 301 redirect if I use Nginx web server?

Resolution

Add rewrite rules into Additional nginx directives section under Website & domains > Web Server Settings , example below redirects request from www to non-www host:

if ($host ~* ^www.example.com$) {rewrite ^(.*)$ http://example.com$1 permanent;}

For more information check NGINX official documentation Creating NGINX Rewrite Rules

Have more questions? Submit a request
Please sign in to leave a comment.