My Profile Photo

Ionut Gavrilut

DevOps Enthusiast | Linux System Administrator | Certified Jenkins Engineer

Redirect encoded URLs in Nginx

Redirect encoded URLs in Nginx

If you want to redirect to, with a 301 redirect in Nginx, add this to your configuration:

rewrite "^/ $" https://$host permanent;

This is only an example to redirects URLs that contain encoded characters. So you need to decode the characters to redirect the URLs.

Test the configuration with:

nginx -t

Reload Nginx with:

systemctl reload nginx