PHP implementation of 301 REDIRECT Code
PHP implements the 301 redirect code as follows:
Header (' http/1.1 301 Moved permanently ');//301 head issued
Header (' location:http://www. ') $strDomain. $request _uri);//jump to my new
Many of the use of Ali server friends, after the installation play configuration system, will involve the domain name 301 redirection settings, but in view of the different use of the system, set the domain name 301 Redirect method is not the same, Shen on Ali Server Linux system Nginx host set 301
The website replaces the domain name, uses the old domain name 301 to refer to the new domain name.
Setting the URL permanently from IIS can be, it looks easy, and it takes a while to discover that the parameters are not on.
From the Microsoft website to find the following instructions, sure enough:IIS 301 Redirection SettingsIt is more convenient to use this time to set IIS redirection. Here is the IIS r
This article explains how to set 301 redirection on IIS, APACHE, ASP, and PHP servers or page programs.301 redirection: it refers to a very important "automatic redirection" technology-in fact, it is not a technology, that is, URL redirection-the user can access an address or directory and specify to jump to another address.301 Redirection. This is the
Web page changes to the search engine friendly after the best way to do is to do 301 redirect, if not temporarily to some or some of the Web page transfer, we all think to do 301 redirect more appropriate.
Web page changes to the search engine friendly after the best way to do is to do
First of all, learn about redirects, commonly used redirect methods are: Redirect, 302 redirect and Meta Fresh.when do I need to do 301 redirects?If you want to change the domain name, you can do 301 Redirect to achieve the search
Many people register multiple domain names for a website. For example, I have registered two domain names www.linkhelper.cn and www.adminlj.com for my linked helper network. Many people may be used to binding all their domain names to one site. In fact, this is very unfavorable for websites, because the search engine will not be clear about which domain name you want to promote. As a result, the search engine will kill one of the domain names and keep only one domain name. What's worse, the two
Regarding 301 redirects the question, the senior seoer all is understands, also knows how to use, does not have to repeat, here mainly uses the example analysis 301 passes the weight the time cycle question.
Let's show you a case:
One might be surprised: 9 days of Web site traffic can reach tens of thousands of? Even if the Aizhan flow estimate is inaccurate, it can not be so outrageous? And i
301 Redirect (301 redirect) also called 301 for permanent transfer (permanently Moved), the various network requests to redirect to another location, is the Web page changes the address of the search engine-friendly, as long as it
Site dead link is not a site will inevitably encounter one of the problems, if you allow dead link no matter, will eventually bring your site into the abyss. For the processing of dead links we can use a 404 error page to tell the search engine and the user that the page does not exist. We can also redirect the page to another page using 301 redirects. Then we have a problem, for the dead link
the Redirect is mainly to the domain name a jump to domain B, more often than not with the domain name of the WWW jump to the domain name with www, then 301 redirect how to do it, this article detailed introduction of the 301 redirect practice, the following is divided into
1. Direct editing. htaccess. qq:452572701
2. Set with cpanel. Reprint Please specify: ZEROSKYHK blog
In essence both are modified documents. htaccess, just the former hand-edited, the latter is done by cpanel. With cpanel operation is quite simple, landing your cpanel–>domain–>redirects, select the appropriate options to complete the settings, here is not discussed. Let's talk about direct editing. Htaccess method. qq:452572701
Note: Be sure to back up the. htaccess file in the corresponding
Some friends may use the method of comparing benzene, add Response.redirectpermanent method under each Controller. The simpler approach is to add the following code to the Global.axax.cs:
The code is as follows
Copy Code
protected void Application_BeginRequest (object sender, EventArgs e){String strurl = Request.Url.ToString (). Trim (). ToLower ();if (Strurl.contains ("Http://111cn.net")){Response.redirectpermanent ("Http://www.111cn.net"); Not good}}
If y
This article mainly introduces PHP implementation of 301 redirect jump, through the example code to let everyone better understand the redirection method, the need for small partners can refer to the next
In PHP 301 Redirection Implementation method is very simple we simply use the header to send 301
Deployment prohibits Chinese browsers from accessing Web sitesin the htaccess file in the root directory of the Web site, add the following statement
############################################
# Enable rewrites
Options +followsymlinks
rewriteengine On
Rewritecond%{http:accept-language} ^zh-cn.*$ [Nc,or]
rewritecond%{http:accept-language} ^zh.*$ [NC]
rewriterule ^.*$ http://www.baidu.com [r=302,l]
Several examples of implementing 301
For example, when I want to access www. domainA. com1.js, I will automatically redirect 301 to www. domainB. com2.js. How to do it? For example, when I want www.domainA.com/1.js to be accessed, I will automatically redirect 301 to www.domainb.com/2.js. How to do it?
Reply content:
For example, when I want www.domainA
301 Redirect, seoer and webmaster are certainly often do, but each search engine for 301 redirect response speed are not the same. Google's needless to say, is the fastest, the actual combat has been proved. So what about Baidu? You shouldn't ask how fast, but how slow you should ask. Some time ago, because the company
For example, when I want to access www. domainA. com1.js, I will automatically redirect 301 to www. domainB. com2.js. How to do it? For example, when I want www.domainA.com/1.js to be accessed, I will automatically redirect 301 to www.domainb.com/2.js. How to do it?
Reply content:
For example, when I want www.domainA
301 Redirect is not unfamiliar, sometimes there is a need to redirect a directory whole to a level two domain name, or the top-level domain request without WWW is all redirected to the two-level domain name with www. If it is Apache, it needs to be configured. Htaccess,nginx is not supported and needs to be implemented using rewrite directives in the configuratio
of the PHP page to enter the following code can be. The code is as follows:
Header ("http/1.1 moved Permanently");Header ("Location:http://www.111cn.net");?>
Second, for the Total station page 301 Jump Solution1, the establishment of 301.php files
(File name yourself)
? php
$the _host = $_server[' http_host '];//get the current domain name
$the _url = isset ($_server[' Reques
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.