I have a hyperlink: http:\some-domain.ca.com and I need to update it to http:\new-domain.pa.com

How do I globally update every single occurrence on the entire Sharepoint site?

I will accept answers for front-end or back-end (bonus for both).

I was thinking of maybe someway to checkout every single file, open it in explorer view, then run a script on that directory of files, but I don't think I can access that explorer view in powershell.


I don't think this is a good practice, but for the front end site, you could add some javascript code on your master page, such as:

    $('a').each(function() {
        // set the old base URL of your site, and the new ones
        var oldBaseUrl = 'http://yoursite.com';
        var newBaseUrl = 'http://yournewsite.com';

        // get old URL, and replace the old base url with new one
        var oldUrl = $(this).attr(href);
        var newUrl = oldUrl.replace(oldBaseUrl, newBaseUrl);

        // set the new URL to the link
        $(this).attr('href', newUrl);

Backend looks like a better option. You could change the site collection URL via SharePoint Management Shell. Have a look at this article.

  • Wouldn't that only apply for the homepage? Unless I added that to every directory which isn't an option – Kellen Stuart Dec 7 '16 at 0:30
  • You could add that to the masterpage, will of course will be applied to the entire site. – Andy Wijaya Dec 7 '16 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.