This is my first post on here and I must admit my knowledge of regular expressions is minimal.
We have recently upgraded our internal intranet from sharepoint 2003 to 2010. During this process we broke down a single site into multiple site collections which added /sites
into the URL for the different sites
eg
http_://intranet/global > http_://intranet/sites/global
http_://intranet/workplaces > http_://intranet/sites/workpaces
I have tried playing around with regular expressions to re-write static URLs to be rewritten to include /sites
You should see the last two records are not being wr-written correctly. Can anyone help me create the correct rule?
REGEX
You may use this:
/^(http://[^/]+)?/(?!(?:sites|SitePages)/)(.*)$/mg
with this replacement
\\1/sites/\\2
DEMO
http://regex101.com/r/zH6dZ5
RESULTS
http://intranet/global > http://intranet/sites/global /sites/global > /sites/global /page/file.ext > /sites/page/file.ext /sites/other > /sites/other /page.ext > /sites/page.ext /intranet/global > /sites/intranet/global http_://intranet/SitePages/default.aspx > http_://intranet/SitePages/default.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.