Very Simple Redirect! (Meta Refresh)

Discussion in 'Programming' started by Elliot02, Sep 13, 2017.

  1. Elliot02

    Elliot02 Aspirant

    36
    13
    +11
    Instant Redirect:
    Code:
    <html>       
       <title>The Admin Zone!</title>     
       <meta http-equiv="refresh" content="0;URL='http://theadminzone.com/'" />   
    </html> 
    If you have your forums in say, /forums/ and want to redirect to it you can use this simple redirect. It helps because you can add little things to this code to run before going. For example, you could do something to give a little bit of information.
    Code:
    <html>      
       <title>The Admin Zone!</title>     
       <meta http-equiv="refresh" content="5;URL='http://theadminzone.com/'" /> 
    <b> Please make sure to be respectful! </b>  
    </html>
    By changing content="0 to 5 this will add 5 seconds until the redirect initiates. This will allow the user time to read the <b> Please make sure to be respectful! </b>

    this is super simple, and there probably is a better way but this is how i've done it.
     
  2. mysiteguy

    mysiteguy Devotee

    2,124
    887
    +1,422
    From an SEO perspective a 301 redirect is the way to go.
     
  3. Elliot02

    Elliot02 Aspirant

    36
    13
    +11
    If my understanding is correct, then a 301 redirect is only more beneficial if you had content on the page previously that ranked well.
     
  4. Ryan Ashbrook

    Ryan Ashbrook IPS Developer

    3,612
    1,127
    +545
    A 301 ("Moved Permanently") will always be beneficial, and is the correct response code to use in this case - you are essentially telling both search engines and browsers that "this page used to live here, but now it permanently lives in this location instead." Ranking of the previous page doesn't necessarily matter in this case, because the response applies to more than just search engines which nets a few benefits - namely:
    1. SERP's will automatically update their indexes with the new location once it learns that the content has moved.
    2. Browsers can cache that redirect, because it now knows that the content has been moved, so it saves an unnecessary request to the server to figure that out and it can just send the user to that location on its own.
    The only downside to this is that you might see a temporary decline in search engine rankings for a period of time, but it almost always recovers. The only time I've seen it not recover is if the redirects were set up improperly. That is why it is important to consider the implications of mass-moving entire sections of a site before you actually do it.

    I also would not recommend delaying the redirect either - generally speaking, unless you have a very specific message that you need to show (usually after the user has taken a specific action - such as updating their profile, or sending a message to a support system), then you should always redirect instantly. Otherwise, it can result in a bad user experience if the user has to wait before they are taken to where they need to go. If a wait period does need to be used, then it should generally not be more than one to two seconds at max.
     
Verification:
Draft saved Draft deleted