I've seen a number of examples of the opposite, but I'm looking to go from an anchor/hash URL to a non-anchor URL, like so:
From: http://old.swfaddress-site.com/#/page/name
To: http://new.html-site.com/page/name
None of the examples at http://karoshiethos.com/2008/07/25/handling-urlencoded-swfaddress-links-with-mod_rewrite/ have functioned for me. It sounds like REQUEST_URI
has the /#/stuff
in it, but neither me nor my Apache (2.0.54) see it.
Any ideas, past experiences or successes?
Anything after the #
is a fragment, and will not be sent to the webserver. You cannot capture it at any point there, you'll have to use a client-sided approach to capture those.
@RobRuchte : would it not be better to use window.location.hash, with a replace instead of a regular expression?
var redirectFragment = window.location.hash.replace(/^#/,'');
if ( '' !== redirectFragment ) {
window.location = 'http://new.html-site.com' + redirectFragment;
}
I'm the author of the post you linked to. Wrikken is correct, the content after the named anchor is not sent to the server unless something has mangled the URL along the way. On the client side, you need some JavaScript like this in your landing page to redirect the swfaddress links to corresponding URLs on another domain:
var re = new RegExp('#(.*)');
var redirectFragment = re.exec(document.location.toString());
if (redirectFragment!=null)
{
document.location = 'http://new.html-site.com'+redirectFragment[1];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With