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
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
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
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
What is the difference between 301 redirect and 302 jump?301 Redirect, also known as "permanent transfer", 301 will transfer the original page weight to redirect the target site above.302 Jump is also called, "temporary jump".Diff
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
First look at a complete code example, about Nginx 301 302 jump.
301 Jump Settings:
server {
Listen 80;
server_name downcc.com;
Rewrite ^/(. *) http://www.downcc.com/$1 permanent;
Access_log off;
}
302 Jump Settings:
server {
Listen 80;
server_name downcc.com;
Rewrite ^/(. *) http://www.downcc.com/$1 redirect;
Access_log off;
}
Take a look at the d
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
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
Recently launched a targeted Japanese website, in order to speed up the speed of Japanese access, with the South Korean DNS service Dnsever accustomed to the free service I used DNS for the first time I met 301 Redirect to the money is not spending is to jump when there is advertising, no way
Thought of using 301 Redirect
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:
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:
In PHP 301 REDIRECT implementation is very simple, we simply use the header to send 301 status code, and then use header to jump, the effect and Apache,iis,nginx are the same effect oh.
One: This method is more recommended because it can transfer all the URLs of Http://www.jb51.net to Http://jb51.net's new address.
The code is as follows
Second: S
the program, as above is constructed in the context of the request, If you want to test in the context of a program in the With App.test_request_context (): code blockJump Orientation:
Description: Flask.url_for is responsible for constructing the URL, while the flask.redirect is responsible for redirecting, receiving 2 parameters, the first is the URL address, the second parameter is the code status code, jump (301) for the old URL before disc
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.