views:

6

answers:

0

I used to use the following bookmarklet code to swap URLs between my site's staging server and live server, so I could test that staged pages had been successfully pushed live:

Staging URL: www.stage.site.com/folder/page.html

Live URL: www.site.com/folder/page.html

Here's the code for that bookmarklet; the script works in both directions: stage to live and live to stage:

javascript:if(location.host=='www.site.com')(location.href='http://www.stage.site.com'+location.pathname);if(location.host=='www.stage.site.com')(location.href='http://www.site.com'+location.pathname);

However, my site architecture has changed (CMS) and the staging URL is now quite different from the live URL:

Authoring URL: author.site.com/bucket1/bucket2/bucket3/folder/page.html

Live URL: www.site.com/folder/page.html

I haven't been able to figure out how to rewrite that bookmarklet code so it can handle the truncated pathname.