This post has been revisited, see the newer version here.
I have a template file that has all relative url’s for all the links and I have this template on two different subdomains, one is used for processing and the other is for static files. When I display something on my processing server I want it to make all the links point the the static pages without modifying the template.
Use jQuery to parse all links and change to the proper domain.
Is there a better method that is automatic such as this? Or maybe a better way to write the jQuery as it stumped me to get it right for a bit.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
My page has 93 links in the template and this doesn’t seem to slow anything down, however this is probably a bad idea on a fully production website because you have a race condition since it is done on the clientside, where they might try to access the relative file on your current domain rather than the modified one once the jquery is done.
I chose this again because you only end up on this subdomain if you have submitted forms for processing and I need to still stay on the server for 1 page after processing, after that I need to link the page back to the original subdomain that contains the static webpage files.