- Options +followsymlinks
- Rewriteengine on
- Rewritecond%{http_host} ^domain.com [NC]
- Rewriterule ^ (. *) $ http://www.domain.com/$1 [l,r=301]
Copy CodeIf you are using a Windows host, you should do 301 steering settings in the Control Panel. Editor's recommendation: php pseudo static URL rewrite rewrite rule introduction php URL rewrite path rewrite example Add: Answer the question of Stone King in the website normalization comment, may be helpful to everybody: As far as I know, html can't do 301 turns. You can only do JS or meta REFRESH in HTML, but not 301 turns. Once the HTML has been read, it has returned a status code of OK. If your page is ASP or PHP can also do 301 turn: asp:
- <%@ Language=vbscript%>
- <%
- response.status= "301 Moved Permanently" Response.AddHeader "location", "http://www.domain.com"
- >
Copy CodePhp:
- Header ("http/1.1 301 Moved permanently");
- Header ("location:http://www.domain.com");
- ?>
Copy CodeIn addition, the Dothtaccess file is just an ordinary text file, you use Notepad to build this file, put the instructions, exist in your account root directory on the line. No need to modify Apache. Q: How long will the search engine handle the web after 301 redirects? Web page with 301 redirect after the original search engine contains the old domain name of the pages will be forwarded to the new domain. Search engine contains the old domain name of the page will change, such as site:www.xxx.com after the old domain name will be transferred to the new domain, how long. A: If your old URL is using HTTP 301 (permanent) redirection to your new website, the search engine automatically learns the new URL when roaming and automatically updates it within 6-8 weeks. 301 redirects to boost search engine optimization results From the perspective of SEO, 301 redirection is the most feasible way to redirect URLs. When the domain name of the site changes, the search engine will only index the new URLs, but also the old address under the original external links to the new address, so that the site will not be ranked because of the change in the slightest impact. Similarly, when you use the 301 Permanent redirect command to point multiple domain names to the site's home domain, there is no negative impact on the site's ranking. |