Skip to main content

Static redirection

Inside a server block:

# use ~* to match a string inside a hostname
if ($host ~* 'living') {
  	# temporary redirect
	rewrite  ^/rewrite-test$  $scheme://$host/rewrite-test.html  redirect;
  	# permanent redirect
	rewrite ^/wp-content/uploads/2020/06/contact-us-button.png$ $scheme://$host/uploads/sites/3/2022/11/contact-us-button.png permanent;
}