My sharepoint bị lỗi 404 file not found năm 2024

Website của bạn đang hoạt động rất tốt tại một dịch vụ hosting, hoặc đang hoạt động trên local mà không gặp bất cứ lỗi gì. Tuy nhiên sau khi đưa lên máy chủ thì xảy ra các lỗi như: trắng trang, lỗi 500, 403,… và không biết phải xử lí như thế nào. Mắt Bão sẽ hướng dẫn các bạn tìm nguyên nhân gây ra lỗi và cách để xử lí những lỗi đó qua bài viết sau.

  1. Xác định nguyên nhân

Để thực hiện xác định nguyên nhân một cách chính xác, các bạn cần cấu hình hiển thị thông báo lỗi trong thiết lập PHP. Để thực hiện, bạn cần xác định vị trí tập tin PHP.ini bằng cách sử dụng lệnh sau:

php –ini

Hoặc sử dụng lệnh

php -i | grep 'Configuration File'

Sau đó câu lệnh sẽ hiển thị vị trí tệp PHP.ini để bạn tiến hành cấu hình, bạn có thể thêm dòng sau vào file PHP.ini: displayerrors = on Lưu lại sau đó khởi động lại PHP để máy chủ nhận cấu hình mới. Thông thường sẽ có một số mã nguồn sẽ cần phải thiết lập thêm trong cấu hình website để có thể hiển thị lỗi, ví dụ: Joomla

  • Đăng nhập trang quản trị: Site >> Global Configuration >> Server >> Error Reporting: Chọn Maximum
  • Hoặc có thể điều chỉnh trong file configuration.php của mã nguồn, cấu hình biến $errorreporting sử dụng các giá trị sau: -1: Tắt thông báo lỗi 30709: Hiển thị tất cả các lỗi ngoại trừ warnings và notices (cấu hình tương đương E_ALL & (E_NOTICE|E_WARNING) ) 30711: Hiển thị tất cả các lỗi bao gồm warnings, không bao gồm notices (cấu hình tương đương  E_ALL & ~E_NOTICE ) 30719: Hiển thị tất cả các lỗi bao gồm warnings và notices, không bao gồm E_STRIC (cấu hình tương đương  E_ALL & E_STRIC) 32767: Hiển thị tất cả các lỗi, warning, notices và các lỗi "strict standards" (ví dụ:  “Strict Standards: Non-static method … on line XX”) (cấu hình tương đương E_ALL )
  • Với mục đích kiểm tra lỗi liên quan đến phiên bản PHP, phần cấu hình này nên sử dụng giá trị 32767 để hiển thị tất cả các lỗi bao gồm gợi ý của PHP về việc các hàm mà mã nguồn đang sử dụng có tương thích / phù hợp với phiên bản PHP mà hệ thống đang sử dụng hay không.

    Ví dụ:

    public $errorreporting = '32767:'; public $logpath = '/home/{user}/logs'; #Đường dẫn lưu file log
  • Tùy thuộc vào phiên bản PHP máy chủ đang sử dụng mà cấu hình hiển thị tất cả các lỗi E_ALL khác nhau như sau: 32767 nếu là PHP 5.4.x trở lên 30719 nếu là PHP 5.3.x 6143 nếu là PHP 5.2.x 2047 nếu là các phiên bản PHP thấp hơn WordPress
  • Thay đổi một số giá trị trong file wp-config.php như sau: /  Bật WPDEBUG mode */ define('WPDEBUG', true); /  Bật chức năng lưu file log ở đường dẫn sau /wp-content/debug.log  */ define('WPDEBUGLOG', true); /  Hiển thị  các lỗi và warnings  */ define('WPDEBUGDISPLAY', true); @iniset('displayerrors',1); Magento
  • Cấu hình trong phần quản lý: Admin >> Configuration >> Developer >> Log Settings >> Enabled = Yes
  • Phân quyền 777 cho folder var/log để lưu log tại 2 file sau: var/log/system.log var/log/exception.log

– Khi sử dụng ngồn ngữ PHP để lập trình website (hoặc mã nguồn có sẵn) thì thường mã nguồn đó chỉ chạy tốt trên một môi trường PHP nhất định (phổ biến nhất là PHP 5.2, PHP 5.3), khi chạy trên môi trường Hosting có phiên bản PHP không phù hợp thì các hàm PHP trong mã nguồn website sẽ không còn được hỗ trợ và hiển thị một số lỗi dạng như sau:

Your server is running PHP version 5.1.6 but WordPress 3.8.2 requires at least 5.2.4. Undefined variable: xxx in homeuserhostingpublic_htmlpath-to-fileabc.php on line 12 Fatal error: Call to undefined method xxx Deprecated: Assigning the return value of new by reference is deprecated in xxx on line 136

– Ngoài ra tùy thuộc vào cấu hình của từng mã nguồn để kiểm tra file thông báo lỗi khác nếu có.

2. Cách khách phục

Việc đọc log sẽ giúp bạn rất nhiều trong việc xác định nguyên nhân và cách xử lý nhanh chóng, tuy nhiên với mỗi mã nguồn sẽ có những vấn đề khác nhau. Mắt Bão giới thiệu đến một số lỗi website phổ biến và cách xử lý như sau:

Nhân Hòa với 20 năm kinh nghiệm kinh doanh mua tên miền, hosting, thuê máy chủ, ssl giá rẻ, email theo tên miền, vps... luôn giữ vững top đầu là nhà đăng ký chất lượng và uy tín nhất Việt Nam. Mọi nhu cầu sử dụng dịch vụ hay phản hồi liên hệ với Nhân Hòa theo địa chỉ sau.

Thanks for visiting our forum. Please kindly note that this forum is an open platform, please be careful to hide your private information when posting.

This error occurs because the site, file, or group was renamed, moved, or deleted.

If you can't find the content that you're looking for, check with your SharePoint administrator. For more information, see How do I find my Microsoft 365 admin?.

Restore a deleted home page

If the site home page was deleted, follow these steps:

Browse to the site recycle bin by pasting this URL into the browser: https://<tenantname>.sharepoint.com/sites/<sitename>/_layouts/15/RecycleBin.aspx?view=5

Important: In the path, replace tenantname with your organization's name and sitename with the name of the site that's missing a home page.
Note: The default name of the page is Home.aspx. However, it might be something different if you've replaced the default home page.

Highlight the file, and select Restore.

If you did not find the file in the recycle bin, it may have moved to the Second-stage recycle bin.

  1. You should see Can't find what you're looking for? Check the Second-stage recycle bin at the bottom of the recycle bin page. Select Second-stage recycle bin.
  2. Highlight the file, and select Restore.

If you did not find the page in the second stage recycle bin, this indicates that it was permanently deleted.

For files or other pages that might have been deleted, see Restore items in the recycle bin that were deleted from SharePoint or Teams.

For more information, see the following pages:

  • Manage the Recycle Bin of a SharePoint site
  • Use a different home page for your SharePoint home page

Check whether the site was deleted

For SharePoint

The site might have been deleted. If so, restore the deleted site from the new SharePoint admin center.

  1. Go to the Deleted sites page.
  2. Select the site to restore.
  3. Select Restore.

Important: If the deleted site was the root (top-level) SharePoint site, you'll have to first restore the site and then replace it by using the steps in Replace your root site.

Check whether the site was redirected

If the user is trying to access the site from a saved site URL or a link to a specific site URL, it's possible that the site URL was changed or that the site was moved or deleted.

If the Site URL was changed, a site redirect page should have been created. For more information, see Manage site redirects.

Important:

  • If the site was removed by using the steps in , a "404" error can occur.
  • To determine which sites have new URLs, see the "To get a list of all redirects" section of Manage site redirects.

If the site was deleted, you can restore it from the SharePoint admin center. For more information, see Restore deleted sites.

For more information, please refer to:

https://learn.microsoft.com/en-us/sharepoint/troubleshoot/administration/error-404-onedrive-sharepoint


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.