regex - Regular Expression URL ReWrite -
this first post on here , must admit knowledge of regular expressions minimal.
we have upgraded our internal intranet sharepoint 2003 2010. during process broke down single site multiple site collections added /sites
url different sites
e.g.
http_://intranet/global > http_://intranet/sites/global http_://intranet/workplaces > http_://intranet/sites/workpaces
i have tried playing around regular expressions re-write static urls rewritten include /sites
you should see last 2 records not being wr-written correctly. can me create correct rule?
regex
may use this:
/^(http://[^/]+)?/(?!(?:sites|sitepages)/)(.*)$/mg
with 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
Comments
Post a Comment