Check out a free preview of the full Full Stack for Front-End Engineers, v2 course:
The "Nginx Redirect" Lesson is part of the full, Full Stack for Front-End Engineers, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Jem compares temporary redirects with permanent redirects, and when to use them.

Get Unlimited Access Now

Transcript from the "Nginx Redirect" Lesson

>> Jem Young: Let's talk a bit more about Nginx. About Nginx as being a web server, a reverse proxy, kinda a jack of all trades, and it's just really, really, really fast. So I wanna show you some common things to do in Nginx. We're not gonna do too much tweaking in this particular section on Nginx.

[00:00:16] But these are things that are useful to know.
>> Jem Young: The redirect, is really powerful in fact, if you got here today, you probably used some sort of redirects. If I wanna create a shortcut on my site, I could say and I can redirect anywhere else. So if you wanted to say I don't know, put a /help path in your application.

[00:00:42] Actually, it wouldn't even be your application, this would be before your application. So your application was at, we proxy pass that to express with that slash. But instead of doing it in express we can do it in Nginx, we can redo all redirects, things like that. Then this is a trivia, but I'm assuming some of you are gonna know it.

[00:01:03] What is the difference between a 301 redirect and a 302 redirect? Mark, you have your hand up, I'm just gonna-
>> Mark: Permanent redirect versus temporary redirect.
>> Student: Okay, then that's [INAUDIBLE]
>> Jem Young: Yes, is that what you were gonna say?
>> Student: That's wrong.
>> Jem Young: It depends, one can be better than the other.

[00:01:19] Let's say your site is temporarily down and you redirect your status page, you wanna do a temporary redirect there. Because the search engines will crawl, and they'll say, this is temporary. We'll check back in a day or two, or an hour, it doesn't really matter. But if you do a permanent redirect, they're gonna mark that as, okay, so instead of going to your site and then the status page, we're just gonna get them straight to the status page.

[00:01:38] So redirects, be a little careful. But as web developers, we should know probably different a temporary redirect in a in a permanent redirects.