将博主url转发给自己的域url

时间:2021-11-24 07:22:17

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

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

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/url-1.html http://example.blogspot.com/url-2.html http://example.blogspot.com/url-3.html。

even non-existing urls
http://example.blogspot.com/non-existing-url-4.html

甚至不存在的url http://example.blogspot.com/non -现有的url - 4. - html

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?

对于这些对应的域名:http://owndomain.com/url-1.html http://owndomain.com/url2.html http://owndomain.com/url3.html http://owndomain.com/ur-3.html http://owndomain.com/non- exist- url4.html,基本上如何保持url地址并将其映射到自己的域名?

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

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

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

1 个解决方案

#1


2  

Three simple steps.

三个简单的步骤。

1) Grab the current URI:

1)获取当前URI:

var blogSpotURI = window.location.href;

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

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

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

3) Then point the browser at the new URI:

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

window.location.href = ownDomainURI;

Complete script:

完整的脚本:

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

Updated Version

更新版本

/* 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; 

#1


2  

Three simple steps.

三个简单的步骤。

1) Grab the current URI:

1)获取当前URI:

var blogSpotURI = window.location.href;

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

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

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

3) Then point the browser at the new URI:

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

window.location.href = ownDomainURI;

Complete script:

完整的脚本:

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

Updated Version

更新版本

/* 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;