For most of the Web site Optimization business site, will habitually do 301 of the domain name without the WWW redirect to with the WWW domain name, so that the weight of the site to better focus together, so as to get better weights and rankings. Many training institutions in the optimization of training, will also repeatedly teach the College 301 redirects the
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
Note: Be sure to back up the. htaccess file in the corresponding directory before you set 301 redirection.
1.301 redirect b.org to www.b.orgThis redirect is designed to make the domain name unique, is the website SEO must do, the back redirects www.b.org to b.org is also for the same reason, but the form is different.
Open the. htaccess file and add the followi
PHP implements the 301 redirect code as follows:
Header (' http/1.1 moved Permanently ');/Send 301 Head
Header (' location:http://www. ') $strDomain. $request _uri);//jump to my new domain address
I wrote 301 code with the 301.inc.php file, and it's all on the head of the
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
Because of the well-known reasons, Aleng blog has to give up ***.cn domain name to migrate space content to godaddy,3 month 28th, I enabled the previous registration of the ***.net domain name, the data migration to the list of GoDaddy to join the ranks of the blog, due to a number of complex reasons, I only do the home page of the 301 redirect, redirect to ***.n
In the daily website construction and optimization, often encounter the site adjustment and change the address, and changes to the directory caused by the URL transformation, and so on, in order to keep the original page has the weight, we need to the page for a permanent redirect to the search engine for a friendly signal. Do 301 redirected pages, you can retain the most significant weight, reduce the impa
During our website construction, webpage redirection is often required: Redirect. In this case, if no redirection is performed, then, the old address in the user's favorites or search engine database can only give the visitor a 404 page error message, and the access traffic is lost. For example, some websites registered with multiple domain names, you also need to redirect users who access these domain name
Nginx URL automatically slashes the problem and 301 redirects, the URL points to a directory and in the end does not contain a slash, will 301 redirect jumps, add server_name or modify access redirection.
Nginx URL automatic slash problem and 301 redirect
The internal serv
However, for virtual host users, 301 redirection is difficult because the virtual host provider typically does not provide this setting.
But for the space where the ISAPI rewrite is installed, 301 redirects are relatively simple.
Here's an example of how you can use the ISAPI rewrite to do 301 redirects correctly.
1.3 version of the domain redirection:
C
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 status code, and
Apache under 301 redirect Code (because I'm using Windows 2003 + Apache so this article is only available to APACHE servers.) )Create a new. htaccess file and enter the following (you need to turn on mod_rewrite):1) Turn the domain name without www to the domain name with www
Options +followsymlinksRewriteengine onRewritecond%{http_host} ^163.com [NC]Rewriterule ^ (. *) $ http://www.163.com/$1 [l,r
directory under new. htaccess below is the code. See for yourself!
The code is as follows
Copy Code
Rewriteengine onRewritebase/Redirect Permanent/Your directory address http://www.111cn.net
Of course, it can be written directly in the root directory.
301, redirect
REDIRECT www.
The first method: direct to the band www without www1, here I use mod_rewrite rewrite URL way to do, before friends remember to check whether your Apache has loaded the rewrite module. The module in the Apahce httpd.conf file.650) this.width=650; "class=" Exp-image-default "alt=" Apache do 301 Redirect method "src=" Http://c.hiphotos.baidu.com/exp/w=500/ Sign=a1e09018fa1986184147ef847aec2e69/503d269759ee3d6
Create a new. htaccess file and enter the following (you need to turn on mod_rewrite):
1 Change the domain name without www to the domain name with www
Copy Code code as follows:
Options +followsymlinks
Rewriteengine on
Rewritecond%{http_host} ^jb51.net [NC]
Rewriterule ^ (. *) $ http://www.jb51.net/$1 [l,r=301]
2 Redirect to new domain
Copy Code code as follows:
ASP Tutorial/asp.net Tutorial/php Tutorial Implementation of 301 redirect code, generally we do 301 is the full use of iis,apache to achieve, in the absence of the operation of the server when we use the script to implement, the code is as follows.1, ASP under the 301 redirect
PHP Implementation 301 Permanent Redirect the domain name without www to the domain name with www, that is, baidu.com redirect to Www.baidu.comIf you only need to complete this function, the PHP code can be written like this:1PHP2 $the _host=$_server[' Http_host '];//get access to the domain name you entered3 $request _url=isset($_server[' Request_uri '])?$_serve
Friends who use ASP.net and follow the new technology may already know that the Response.redirectpermanent () method has been added in ASP.net 4.0 to achieve permanent redirection, and the effect of the method is clearly explained in the annotation: execution from the requested URL to the specified A permanent redirection of URLs and provides options for completing the response.
In the ASP.net MVC 3 project, we can use the following notation to implement permanent redirection as needed:
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.