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.com/1.js to be accessed, I will automatically redirect 301 to www.domainb.com/2.js. How to do it?
301 redirection is a response from the server, so it can only be implemented by setting the server or using the script language of the server. ToapacheFor example, you can configure.htaccessFile implementation. The add statement is as follows:
redirect 301 /i.js www.domainB.com/2.js
The implementation of the script languagephpFor example, the Implementation statement is as follows:
header('Location: http://www.domainB.com/', true, 301);exit;
Others, suchjavascriptAndmetaThe redirection of tags should not belong to the permanent page orientation (that is, 301 redirection ).
However, you can usejavascript301 redirection.javascriptStore the page information to be redirectedcookieAnd thenphpReadcookieTo determine whether to perform 301 redirection, but this method is still inseparable from the support of the backend.
Are 301 redirects possible using javascript or jQuery?