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

Forward blogger urls to own domain urls

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

转发所有这些:
http://example.blogspot.com/url-1.html
http://example.blogspot.com/url-2.html
http://example.blogspot.com/url-3.html

甚至不存在urls
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.html
http://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;