I have the following relative URL (my website is www.web1.com).
<a href="/28518/verona-torino" target="partidos"> View! </a>
I need another URL (not www.web1.com) inserted here, either from JavaScript, PHP, or .htaccess.
The code should be as follows:
<a href="http://www.web2.com/28518/verona-torino" target="partidos"> View! </a>
Editing the HTML manually is not an option.
Top of all PHP files
<?php
define('URL', 'http://www.web2.com/');
?>
In HTML you can now do this
<a href="<?php echo URL; ?>28518/verona-torino" target="partidos"> View! </a>
If you use jquery library, this may help:
$.each('a', function() {
var t = $(this).attr('href');
$(this).attr('href', 'http://www.web2.com'+t);
});
Be aware that it's not SEO friendly way.