Mobile app version of vmapp.org
Login or Join
Mendez628

: What defines a permenant redirect? I'm a little confused between a 301 redirect, the javascript meta http-equiv="refresh approach and lastly using a 404 which can work out where you wanted to

@Mendez628

Posted in: #301Redirect #302Redirect #Redirects

I'm a little confused between a 301 redirect, the javascript meta http-equiv="refresh approach and lastly using a 404 which can work out where you wanted to get to and then forward you on.

I can see that a 301 (and a 302) potentially may never pass the original HTML page to the client (it can be handled on the server, such as in IIS or Apache and when it finds the 'new' page to show, only that page is passed to the browser) where as the meta-refresh requires the page to be dished to the browser and then an action takes place (the forwarding).

However, the 404 page may also never be sent to the browser! Consider find a page, IIS can't find it, so dish out the 404. The 404 has some server code, which contains the forwarding logic. Hence, only 1 page will be sent to the browser.

Is the fact the server only returns 1 result (1 HTML page) that makes it a permanent 301 and so either using URL re-writing or the above example of the 404 are identical (identical in that it's treated as a 301)?

If this is the case, how does this actually differ from a 302? Do we need to add some meta information to explain it's a 302 or 301? My research suggests not.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Mendez628

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

I think your question is a bit confusing, probably mainly because you have some terminology mixed up.

A redirect literally just means that a client tried to load a certain URL, and the server redirected them to another page. Whether or not this is the page the user intended has little to do with it from a technical standpoint.

A HTTP Status code is a means for the server to pass on information about the requested page. For example, if a page was not found it sends a code 404 "Not found". Generally when talking about redirects on a server level, people refer to the 301 ("Permanently moved") or 302 ("Temporarily moved") status codes.

If you would set a certain page (e.g. your custom 404.html) to show as your error page, technically the client is redirected from the requested URL to the actual 404 page. However, the status code doesn't change, causing this to be interpreted as a "Not found" for all intents and purposes, even though there has been some kind of redirection going on.



There are several ways to send a status code to the client, among which are using rewrite rules on a server level (Apache/IIS) and sending the headers from within the server-side code that is executed (PHP, Perl, etc).

However, <meta http-equiv="refresh"> is not one of them. This an HTML tag that is interpreted on the client side, after the server has done it's thing. The same goes for any client-side javascript that may redirect the visitor to another URL. This simply works the same way as being on a page and clicking a link to the other page.

To make things a little more confusing, for SEO purposes Google chose to interpret a http-equiv="refresh" with a time-out of 0 seconds (an instant redirect) as a status code 302. This is just their interpretation, and nothing official. From a technical standpoint (you can verify this while watching the network tab of your developer console when loading a page with a refresh on it) it is just a page load (status 200) immediately followed by another page load.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme