Is it possible to create a custom 404 error page in SharePoint Online

Nicholas Cottrell 1 Reputation point
2020-08-17T08:41:23.353+00:00

I am wanting to create a custom 404 error page for a site collection in a communication site in SharePoint Online. I've been looking around but can only find guidance out there for older versions of SharePoint but I can't seem to do in SharePoint Online. Is it possible to create a custom 404 error page in SharePoint Online?

I've had some guidance on using SharePoint Designer 2013 to do this but so far this has failed for us too. If it is possible to create a custom 404 error in SPO, does anyone know a PowerShell way of doing it?

Thanks in advance.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,693 questions
0 comments No comments
{count} votes

8 answers

Sort by: Most helpful
  1. MichaelHan-MSFT 18,016 Reputation points
    2020-08-18T02:33:11.583+00:00

    Hi @Nicholas Cottrell ,

    You could create a custom 404 error page in the pages library. Then configure the page as a default 404 page not found error page. This can be done either through PowerShell or using SharePoint Designer. Please refer to this article for more: implement-custom-page-not-found-error-page-in-sharepoint-online

    Using SharePoint Designer to set Custom Page not found error page:
    You can also use SharePoint designer to set the custom page not found error page: Here is how:

    • Open your SharePoint Online site collection in SharePoint Designer 2013
    • Select the Site object on the left side navigation, Click on Site Options button in the ribbon
    • Assign the "vti_filenotfoundpage" property of the site to a Custom Error Page URL that you created. (Add a new entry, if it doesn't exist)
      18191-17.png
    • Click on "OK" button to commit your changes.
    0 comments No comments

  2. Nicholas Cottrell 1 Reputation point
    2020-08-18T08:13:40.263+00:00

    Thanks @MichaelHan-MSFT . I've tried this one a few times but been having a 403 error. The vti_filenotfoundpage is not in the list so I create (Add) and point towards the new page. It's when I select Apply that I get the 403 error (see attached)18265-picture1.png

    I have run a PowerShell script to enable custom script. I left for a few days and went back to attempt these steps and it still had the same 403 error. Any ideas?

    0 comments No comments

  3. MichaelHan-MSFT 18,016 Reputation points
    2020-08-18T08:27:01.727+00:00

    Hi @Nicholas Cottrell ,

    The value should be like this: /sites/michael/Pages/404.aspx. In your scenario, it should be /sites/MyHub/SitePages/Error.aspx.

    Besides, you need to have site collection administration permission to edit this.

    0 comments No comments

  4. Nicholas Cottrell 1 Reputation point
    2020-08-19T10:53:59.603+00:00

    @MichaelHan-MSFT thanks for the feedback, really appreciate it. I've changed the value as suggested and still getting the same 403 FORBIDDEN error. I am running SPD as administrator and also logged in as an admin for this site. Do you have any ideas?

    0 comments No comments

  5. MichaelHan-MSFT 18,016 Reputation points
    2020-08-20T07:54:32.567+00:00

    Hi @Nicholas Cottrell ,

    Another possibility is that custom script is disabled for your site. So it's forbidden to edit "vti_filenotfoundpage" property.

    You could use the below command to allow custom script on your sites:

    Connect-sposervice https://tenant-admin.sharepoint.com  
    Set-SPOsite https://tenant.sharepoint.com/sites/michael -DenyAddAndCustomizePages 0  
    

    Please refer to this article:

    https://learn.microsoft.com/en-us/sharepoint/allow-or-prevent-custom-script

    0 comments No comments