Results 1 to 2 of 2

Thread: .htaccess rewrite to remove hashes

  1. #1
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default .htaccess rewrite to remove hashes

    Hi, first of all, I've been searching all night for a solution to this and haven't been able to find anything. Most [RESOLVED]s I've found have been about manipulating the anchors within the page etc.

    I have a Joomla! site in a subdirectory from the root and in the root's index.php I have a full screen iframe displaying the Joomla! site. It all works perfectly and I've got quite far, just one last step to do.

    Why would I do this you ask? Well, I've done it to enable a radio player on the site that works asynchronously to the site, so that it doesn't refresh on each page refresh.

    This is the code snippet I'm using:
    PHP Code:
            function locFix() {
                
    //DEBUG alert("locFix function [FOUND]");
                
    var iframe document.getElementById("siteframe");
                var 
    relUri iframe.contentWindow.location.pathname;
                
    //DEBUG alert(relUri);
                
    window.location.hash relUri;
            } 
    Code:
    <body><iframe src="joomla/index.php" id="siteframe" frameborder="0" marginwidth="0" marginheight="0" width="100%" height="100%" onload="locFix();"></iframe></body>
    This works brilliantly but I want it slightly better with something I'm sure you can do with mod_rewrite, I just haven't been able to find out how.

    The script sets the url to http://www.domain.com/#/joomla/index.php but I'd like to rewrite that url to http://www.domain.com/index.php or even http://www.domain.com/joomla/index.php if that's not possible. Just so that it's Search Engine friendly and idiot proof (user proof! ).

    Facebook uses the same technique to handle embedded iframes' urls, but I haven't been able to find the rewrite rule at all.

    Thank you for any hep you can give on this. I can give any more information needed, I hope it's clear what I'm trying to achieve.

  2. #2
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default

    I've found one other slight bug. Should be easily fixable but I'm not sure how or where to place the code.

    As above, when you change the source of the iframe, the url in the address bar displays properly, other than the erroneous /#/ directory. However, when you navigate directly to a sub page, the iframe does not update. This is obvious as there's no code to update the source of the iframe.

    I need to be able to programmatically refresh the iframe src dependent on the initial address. Doing thi in JavaScript sends it into an infinite loop, by updating the iframe source then the page url and so on; so I assume it would have to be done in PHP.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •