将博主网址转发到自己的域网址 [英] Forward blogger urls to own domain urls

查看:98
本文介绍了将博主网址转发到自己的域网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I forward all urls on my blogspot to my own domain's corresponding urls? Example:

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

Forward all of these:
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

even non-existing 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地址并将其映射到自己的域上?

To these corresponding own domain:
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
basically, how to keep the url address and map it onto the own domain?

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

I already have this, but this is only redirecting the homepage of blogspot to homepage of my own domain:

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

推荐答案

三个简单步骤.

1)抓取当前URI:

1) Grab the current URI:

var blogSpotURI = window.location.href;

2)然后用您自己的域替换blogspot域:

2) Then replace the blogspot domain with your own domain:

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

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

3) Then point the browser at the new 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; 

这篇关于将博主网址转发到自己的域网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆