A good[ish] website

Web development blog, loads of UI and JavaScript topics

Different ways to redirect a URL

Filed under: Server— Tagged with: apache, nginx

A quick guide on redirection with Apache, NGINX, or with plain HTML.


Use the APache Redirect directive, paste this in your .htaccess file:

Redirect 301 /


Paste this in your NGINX server block, or into a nginx.conf file in your projects root.

server {
  # Redirect this address

  # this address
  return 301 $scheme://$request_uri;

Using meta redirect

A more "lighter" method with timing. This goes into the head tag:

<meta http-equiv="refresh" content="0; url=" />

That 0 is a time in seconds for how long the browser waits until doing the redirect.

Comments would go here, but the commenting system isn’t ready yet, sorry.

  • © 2022 Antti Hiljá
  • About
  • All rights reserved yadda yadda.
  • I can put just about anything here, no one reads the footer anyways.
  • I love u!