将博主网址转发到自己的网域网址



如何将博客上的所有网址转发到我自己域的相应网址?例:

转发所有这些:

http://example.blogspot.com/url-1.html
http://example.blogspot.com/url-2.html
http://example.blogspot.com/url-3.html

甚至不存在的
网址
http://example.blogspot.com/non-existing-url-4.html

对于这些相应的自己的域:

http://owndomain.com/url-1.html
http://owndomain.com/url-2.html
http://owndomain.com/url-3.htmlhttp://owndomain.com/non-existing-url-4.html
基本上,如何保留URL地址并将其映射到自己的域?

我已经有了这个,但这只是将blogspot的主页重定向到我自己域的主页:

<script type='text/javascript'>
  var d='<data:blog.url/>';
  d=d.replace(/.*//[^/]*/, '');
  location.href = 'http://owndomain.com';
</script>

三个简单的步骤。

1) 获取当前 URI:

var blogSpotURI = window.location.href;

2)然后将blogspot域名替换为您自己的域名:

var ownDomainURI = blogSpotURI.replace('example.blogspot.com', 'owndomain.com');

3) 然后将浏览器指向新的 URI:

window.location.href = ownDomainURI;

完整脚本:

var blogSpotURI = window.location.href;
var ownDomainURI = blogSpotURI.replace('example.blogspot.com', 'owndomain.com');
window.location.href = ownDomainURI;

更新版本

/* grab URI from browser address bar */
var blogSpotURI = window.location.href; 
/* remove subdomain and domain */
var ownDomainURI = blogSpotURI.replace('http://example.blogspot.', ''); 
/* Find position of first forward slash after the TLD */
var slashPosition = ownDomainURI.indexOf('/');
/* Remove the TLD */
ownDomainURI = ownDomainURI.substring(slashPosition);
/* Add new domain and new TLD */
ownDomainURI = 'http://owndomain.com' + ownDomainURI; 
/* Point browser window at new address */
window.location.href = ownDomainURI; 

最新更新