' ;"; 2. Through "header ("Location:".$url);" method to implement domain name redirection."/> ' ;"; 2. Through "header ("Location:".$url);" method to implement domain name redirection.">

Home  >  Article  >  Backend Development  >  How to implement php domain name redirection

How to implement php domain name redirection

藏色散人
藏色散人Original
2022-11-09 09:59:551027browse

How to implement php domain name redirection: 1. Through "echo 'a3a4498d4515351b096ea2f20fe60b6f' ;" Domain name redirection; 2. Domain name redirection is implemented through "header("Location:".$url);".

How to implement php domain name redirection

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

How to implement php domain name redirection?

Two ways to write domain name redirection in php

The first one

echo &#39;<meta http-equiv="Refresh" content="0;url=&#39; .  $url . &#39;">&#39; ;

The second one

header("Location:".$url);

Expansion introduction:

1.http-equiv=http response header

2.http-equiv and content attribute name/value pairs. When the server sends a document to the browser, it will first send these name/value pairs

3.ecec3fc2a5cc16cc92df94f48998af64

   <!--1.禁止浏览器从本地机的缓存中调阅页面内容,设定后一旦离开网页就无法从Cache中再调出 -->
     <meta http-equiv="pragma" content="no-cache">
   <!--2.清除缓存(再访问这个网站要重新下载!)-->
     <meta http-equiv="cache-control" content="no-cache">
   <!--3.设定网页的到期时间,一旦网页过期,必须到服务器上重新传输。-->
     <meta http-equiv="expires" content="0">   
   <!--4.关键字,搜索引擎用-->
     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
   <!--5.页面描述-->
     <meta http-equiv="description" content="This is my page">
   <!--6.html+utf-8-->
     <meta http-equiv="content-type" content="text/html;charset=utf-8">
     <!--7.几秒后页面自动跳转-->
   <meta http-equiv="Refresh" content="2;URL=http://www.net.cn/">
     <!--8.Set-Cookie如果网页过期,那么存盘的cookie将被删除-->
     <meta http-equiv="Set-Cookie" content="cookievalue=xxx;expires=Wednesday, 20-Jun-200722:33:00 GMT; path=/">

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to implement php domain name redirection. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn