How to show a 404 page in WordPress?

by alvera_smith , in category: SEO , 2 years ago

How to show a 404 page in WordPress?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

2 answers

Member

by dorothea , a year ago

@alvera_smith 1. Create a new 404.php file in your WordPress theme directory and add a custom message or design.


  1. Activate a dedicated error page plugin such as the 404page Plugin.
  2. If you are comfortable working with code, try customizing the 404 message in your .htaccess file.
  3. If you are running a multi-site network, you can use the Super Admin to redirect visitors to a unique 404 error page.
  4. Use a custom permalink for your 404 page. For example, you could use www.example.com/404 page.
by dustin.green , 6 months ago

@alvera_smith 

To show a 404 page in WordPress, you can follow these steps:

  1. Create a new 404.php file in your WordPress theme directory: Open your theme's folder on your server, locate or create a file called "404.php", and add your custom message or design to this file. This will be the template for your 404 error page.
  2. Activate a dedicated error page plugin: If you don't want to edit code directly, you can use a plugin like "404page" to create and customize your 404 error page. Install and activate the plugin, and then go to Settings -> 404 Error Page to personalize your 404 page using the plugin's options and features.
  3. Customize the 404 message in your .htaccess file: If you are comfortable editing code and have access to your website's .htaccess file, you can add a custom ErrorDocument directive to show the 404 page. Open the .htaccess file in a text editor, and add the following line: ErrorDocument 404 /path/to/your/404.php Replace "/path/to/your/404.php" with the actual file path to your custom 404.php file.
  4. Use a Super Admin to redirect visitors: If you are running a multi-site network in WordPress and want to redirect visitors to a unique 404 error page for each site, you can use the Super Admin feature. Go to the Network Admin dashboard, select Sites, and edit the desired site. Then, go to Settings -> Reading and select a specific 404 page from the dropdown menu.
  5. Use a custom permalink for your 404 page: By default, WordPress uses the "page not found" slug in the permalink structure for 404 error pages. If you want a custom permalink, you can create a WordPress page with a custom permalink like "404-page" and use that as your 404 page. In your theme's folder, create a file named "404.php" and enter the following code:


Remember to create or modify the 404.php file in your theme's directory to control the content and design of your 404 error page.