What is the difference between http-equiv redirection and header redirection? There is no difference between the two.

Source: Internet
Author: User
& Amp; lt ;? Php {code...}. What is the difference between php {code...} and above code that implements redirection with the header?

session_start();if(isset($_SESSION['userId'],$_SESSION['name'],$_SESSION['rights'])){ echo " ";}else{ echo " ";}

In the above Code, what is the difference between this jump and the header implementation?

Reply content:


session_start();if(isset($_SESSION['userId'],$_SESSION['name'],$_SESSION['rights'])){ echo " ";}else{ echo " ";}

In the above Code, what is the difference between this jump and the header implementation?

The difference is:

Meta redirect can be applied to situations where http headers have been sent out. For example, if a webpage has already been rendered in half, it has to be redirected. Another advantage is that it can be delayed.

Header redirect is used to redirect http headers before they are sent. For example, when a webpage is opened and not rendered, it is redirected.header("Location: url", $status_code). You can also add status code and the former will not work.

I prefer headers and use meta redirect. Occasionally, the jump fails, and the header redirect can be added with status_code, which is better for seo.

Like your code, use the header.session_start();The call can be successful only when http headers has not been sent.

If meta redirect is required, we recommend that you addexit;

Think about it, one is on the server, and the other is on the browser. It's not good .....:[

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.