The scenario is as such:-

There exists a word document in a document library. We know that we can directly access this document with a specific URL.

Now I want this to happen :-

Whenever someone goes to this document link URL, he/she should get redirected to new SharePoint site page rather than the document itself.

I have read about one way that is 'Symmetrical Rewrite URL', but does we have any other way to do this?

Any help would be much appreciated.


I have a workaround to your request via Jquery by

  • Checking if the current URL have a specific value based on your URL I put ('&file=') as a value that repeated to all URL when I open documents.
  • Redirect to your URL.


  • Open the Document library page > Edit it.
  • Add content editor or script editor web part and make sure you have a reference to Jquery. (/Style%20Library/js/jquery.min.js)

  • Paste the following code.

<script type="text/javascript">
$(document).ready(function () {
    if(window.location.href.indexOf("&file=") > -1) {
      window.location.href = "http://consto.sharepoint.com/Edgeconsto/home.aspx";
  • I am also here if you need more clarification – Mohamed El-Qassas MVP Aug 1 '16 at 13:33
  • M.Qassas thank you for replying but i do not get you here, content editor web part will be added to to document library , but i am talking about a word document(opened) in sharepoint online. I need to redirect that link to a new sharepoint site page. – mohd tahir Aug 1 '16 at 13:38
  • M.Qassas sir i mean to ask how do i add a web part to a document? I know how to add a web part to a document library but how to add a web part to a documnt directly? – mohd tahir Aug 1 '16 at 13:54
  • you are right let me check if there is method to check the url before navigation – Mohamed El-Qassas MVP Aug 1 '16 at 14:04
  • Okay! I am here waiting till that. – mohd tahir Aug 1 '16 at 14:05

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.