regex.htaccesshttp-redirectbloggerurl-masking

Mask forwarded blogger urls to own domain urls


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.


Solution

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