Mask forwarded blogger urls to own domain urls

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 17:34:24

You can use the following JavaScript snippet for that -

<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 -

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)

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.

the code in htaccess file should be like this:

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!