掩盖转发博客网址到自己的域名网址

时间:2021-08-23 06:52:18

Following Rounin's answer carefully written (thanks a lot) on how to redirect any blogspot urls with any extension to the mydomain.com corresponding URL, now the question is how can I mask the URL? I mean, once the blogspot URL redirects to the mydomain.com, I want to continue to display the original blogspot URL instead of the mydomain.com.

按照Rounin的回答仔细编写(非常感谢)如何将任何具有任何扩展名的blogspot网址重定向到mydomain.com对应的URL,现在的问题是如何屏蔽URL?我的意思是,一旦blogspot URL重定向到mydomain.com,我想继续显示原始的blogspot URL而不是mydomain.com。

2 个解决方案

#1


4  

You can use the following JavaScript snippet for that -

您可以使用以下JavaScript代码段 -

<script>
    site = "http://example.com"; // The site which you want to mask, don't add ending slash
    iFrame = document.createElement("iframe"); // Creates a iframe via JavaScript
    iFrame.setAttribute("src", site + location.pathname); // Set the source of iFrame
    iFrame.setAttribute("class", "maskingFrame"); // Add class to iFrame
    document.body.appendChild(iFrame); // Append iframe to body of page
</script> 

And the bare minimal CSS would be -

而最小的CSS将是 -

body {
    overflow:hidden;
}
.maskingFrame, body {
    width:100%;
    height:100%;
    border: none;
}

You can check a demo here (This is the homepage) and here (This is an internal URL from other site which doesn't exist on the original blogspot URL)

您可以在此处查看演示(这是主页)和此处(这是来自其他站点的内部URL,原始blogspot URL上不存在)

#2


-1  

In privous answer you redirected page from blogspot to your domain. This causes the url to be changed. But if you want to show contents from another url without changing url it could be done through using .htaccess file.

在私下回答中,您将页面从blogspot重定向到您的域。这会导致URL被更改。但是如果你想在不改变网址的情况下显示其他网址的内容,可以通过使用.htaccess文件来完成。

the code in htaccess file should be like this:

htaccess文件中的代码应该是这样的:

RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) http://DomainB.com/$1 [P] 

Here you could find more details and info about .htaccess file.

在这里您可以找到有关.htaccess文件的更多详细信息和信息。

I don't know if it is possible for you to place that file in your blog or not. If you have not access to place this file into your blog you can place it on your domain host, and redirect from your domain to your blogspot page but if ask me I recommend you redirect and encourage people to your own website rather than keeping them using weblog address. You'll not need weblog if you have your own website.

我不知道您是否可以将该文件放在您的博客中。如果您无权将此文件放入您的博客,您可以将其放在您的域名托管服务商上,并从您的域名重定向到您的博客热线页面,但如果问我,我建议您重定向并鼓励用户访问您自己的网站,而不是让他们继续使用博客地址。如果您有自己的网站,则不需要博客。

#1


4  

You can use the following JavaScript snippet for that -

您可以使用以下JavaScript代码段 -

<script>
    site = "http://example.com"; // The site which you want to mask, don't add ending slash
    iFrame = document.createElement("iframe"); // Creates a iframe via JavaScript
    iFrame.setAttribute("src", site + location.pathname); // Set the source of iFrame
    iFrame.setAttribute("class", "maskingFrame"); // Add class to iFrame
    document.body.appendChild(iFrame); // Append iframe to body of page
</script> 

And the bare minimal CSS would be -

而最小的CSS将是 -

body {
    overflow:hidden;
}
.maskingFrame, body {
    width:100%;
    height:100%;
    border: none;
}

You can check a demo here (This is the homepage) and here (This is an internal URL from other site which doesn't exist on the original blogspot URL)

您可以在此处查看演示(这是主页)和此处(这是来自其他站点的内部URL,原始blogspot URL上不存在)

#2


-1  

In privous answer you redirected page from blogspot to your domain. This causes the url to be changed. But if you want to show contents from another url without changing url it could be done through using .htaccess file.

在私下回答中,您将页面从blogspot重定向到您的域。这会导致URL被更改。但是如果你想在不改变网址的情况下显示其他网址的内容,可以通过使用.htaccess文件来完成。

the code in htaccess file should be like this:

htaccess文件中的代码应该是这样的:

RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) http://DomainB.com/$1 [P] 

Here you could find more details and info about .htaccess file.

在这里您可以找到有关.htaccess文件的更多详细信息和信息。

I don't know if it is possible for you to place that file in your blog or not. If you have not access to place this file into your blog you can place it on your domain host, and redirect from your domain to your blogspot page but if ask me I recommend you redirect and encourage people to your own website rather than keeping them using weblog address. You'll not need weblog if you have your own website.

我不知道您是否可以将该文件放在您的博客中。如果您无权将此文件放入您的博客,您可以将其放在您的域名托管服务商上,并从您的域名重定向到您的博客热线页面,但如果问我,我建议您重定向并鼓励用户访问您自己的网站,而不是让他们继续使用博客地址。如果您有自己的网站,则不需要博客。