A good[ish] website

Web development blog, loads of UI and JavaScript topics

Different ways to redirect URL

Filed under: Server— Tagged with: .htaccess, apache, nginx, snippets

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


A very robust way of redirecting. Just 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 {
  # Direct this address...

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

Using meta redirect

A bit more "lighter" method with timing. Paste this inside your head tag.

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

That 0 is a time (in seconds) how long the browser waits for the redirect.

Comments would go here, but the commenting system isn’t ready yet, sorry. Tweet me @hiljaa if you want to make a correction etc.

  • © 2021 Antti Hiljá
  • About
  • Follow me in Twatter → @hiljaa
  • All rights reserved yadda yadda.
  • I can put just about anything here, no one reads the footer anyways.
  • I love u!