Forum Discussion

mrueegger's avatar
mrueegger
Copper Contributor
Jun 02, 2022

Redirect SharePoint modern page

Is there a possibility to make a redirect from one page to another. Attention I am not talking about redirect site to another site, for this topic you can find many instructions.

However, I would like to rename a page and then redirect the page from the old url name to the new.

old.aspx to new.aspx

Unfortunately there is no possibility to insert a Java Script. Otherwise this would be relatively simple to accomplish. I suspect that there is no way. Would that eventeull be a feature that could be done. This is certainly not a unique case.

  • mrueegger I don't think this is possible using SharePoint OOTB capabilities.

     

    However, you can use Modern Script Editor web part developed using SPFx by Mikael Svenson to inject the custom JavaScript on modern page. Using custom JavaScript you can easily redirect user to another page.

    Link to web partScript editor web part for modern pages 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    • mrueegger's avatar
      mrueegger
      Copper Contributor
      Ist leider von der Organisation zweck sicherheit nicht freigegeben.
  • mattchowell's avatar
    mattchowell
    Iron Contributor

    Ridiculous that such a basic functionality hasn't been thought through by Msft. 

  • Hi mrueegger 

    It is possible using out of the box SharePoint Online functionality to redirect a page to another page.

    For example in my intranet I have a page /sites/intranet/sitepages/old.aspx

    It contains useful information. After a restructure that information is now owned and maintained by the safety team who have their own communications site ( /sites/safety/ ) , and already have an old.aspx so they have to rename the page to new.aspx  

    In summary our old page is here:

    • /sites/intranet/sitepages/old.aspx

    the new page is here

    • /sites/safety/sitepages/new.aspx

    To ensure that anyone who goes to /sites/intranet/sitepages/old.aspx is redirected to /sites/safety/sitepages/new.aspx we have to do the following:

    • in this library /sites/intranet/sitepages/ add an out of the box content type called "Link to a Document" 
      • you may have to enable content types for the site pages library and or the intranet site
    • now delete the /sites/intranet/sitepages/old.aspx
    • then in the SitePages library use the New button to create a new "Link to a document"
    • in the /sites/intranet/sitepages/ library you'll now have an old.aspx

     

    You can use the same solution if you have some custom ASPX files which redirect users (created pre 2024), but new copies of those ASPX files download to the user's computer.

Resources