/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var linkRewriter = function(old_domain, new_domain) { $('a[href*="' + old_domain + '"]').each(function() { if ($(this).attr('href') == old_domain ) { $(this).attr('href', $(this).attr('href').replace(old_domain, new_domain)); } }); }; linkRewriter('www.olddomain.com', 'www.newdomain.com');
Comments
