I have a wiki library which contents is automatically copied onto another site. Some of the pages in the library contain images, the links to those images are relative.


page: http://www.siteA.com/wiki/pages/home.aspx

image: /wiki/images/image.jpg

Now I have a script which exports the wiki and images libraries, and imports them on another site. But on that site, the library is placed in a different subsite:


Now although the images library is in the same subsite as the wiki (like it was on siteA), the images still break. They keep on pointing to /wiki/images/image.jpg instead of /subsite.wiki/images/image.jpg.

So now I'm looking for a way to correct this, preferably in a powershell script, since the exporting / importing is done in powershell too. What's a good way of doing this?

  • Have you tried to use url token.For e.g. {SiteUrl}. I am not sure it work in wiki page Nov 18, 2011 at 16:21

2 Answers 2



You could try modifying the content from each wiki page through powershell by replacing the old URL with the new one.

The following blog post can help you with it: http://jrich523.wordpress.com/2011/11/14/modify-a-sharepoint-2010-probably-2007-as-well-wiki-page-with-powershell/

$content = $wiki.data.row.ows_WikiField
$content = $content -replace "/wiki/images/", "/subsite/wiki/images/"

Regards, EStruyf


For future readers: I created a Powershell script which does the same, but without the need to use the webservices. http://blog.repsaj.nl/?p=434

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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