Mask forwarded blogger urls to own domain urls
Asked Answered
K

2

6

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.

Koser answered 30/1, 2016 at 21:54 Comment(1)
I'm not sure I fully understand what your trying to accomplish. You state "I want to continue to display the original blogspot URL instead of the mydomain.com". I wonder if you mean that you want to show the original blogspot subdomain and domain in the location bar? So that content for maskedurl.blogspot.com/2013/03/illustrations.html would show up in the document, but window location would show as maskedurl.blogspot.com. Either way maybe this helps. #824849Binder
N
4

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)

Nashner answered 16/2, 2016 at 4:30 Comment(0)
S
-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.

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.

Spitz answered 12/2, 2016 at 4:54 Comment(2)
how can I access the blogspot htaccess file? where is it? where should I put this code in the blogspot?Koser
@Mpondomise It's a file which can be placed at any folder of a website. For placing a file you need at least a ftp access. I doubt you have ftp access for a blog. So it could not be possible for you to redirect from blog to domain preserving your blog address. But it's possible if redirect from domain to weblog.Spitz

© 2022 - 2024 — McMap. All rights reserved.