Forum Discussion
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 part: Script 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.
- mrueeggerCopper ContributorIst leider von der Organisation zweck sicherheit nicht freigegeben.
- mattchowellIron Contributor
Ridiculous that such a basic functionality hasn't been thought through by Msft.
- Dorje-McKinnonSteel Contributor
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"
- you'll be asked for the "document name" , enter old
- you'll be asked for the "document url" , enter https://<YourTenant>.sharepoint.com/sites/safety/sitepages/new.aspx
- click OK
- in the /sites/intranet/sitepages/ library you'll now have an old.aspx
- if you click on the name in the library
OR - if you link to the full URL https://<YourTenant>.sharepoint.com/sites/intranet/sitepages/old.aspx it will redirect you to new.aspx
- if you click on the name in the library
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.