Our Help Portal

Troubleshooting Support Articles
Searchable Help Information Repository
Self-Service Resources How-Tos
Technical Customer Walkthroughs   Browse All Knowledge ! ....

Get Prices Learn More


< All Topics

How to redirect the 404 Error page in WordPress?

Redirecting the 404 error page in WordPress can be achieved by using a redirection plugin or by editing your theme’s functions.php file. Here are two methods you can use:

Method 1: Using a Redirection Plugin (Recommended for Beginners)

  • Install a Redirection Plugin:
    • Go to your WordPress admin dashboard.
    • Navigate to “Plugins” > “Add New.”
    • Search for a redirection plugin, such as “Redirection” or “404 to 301.”
    • Install and activate the plugin.
  • Configure the Redirection:
    • Once activated, go to “Tools” > “Redirection” in your WordPress dashboard.
    • Click on the “404s” tab.
    • Add a new redirection rule by entering the source URL (the 404 page) and the target URL (the page where you want to redirect users).
    • Save the changes.
  • Test the Redirection:
    • Open a new browser window or tab and try accessing a non-existent page on your website to see if the redirection is working as expected.

Method 2: Editing functions.php (Advanced Users)

  • Access Theme Files:
    • Connect to your WordPress site via FTP or use the file manager provided by your hosting control panel.
    • Navigate to the directory containing your WordPress theme.
  • Edit functions.php:
    • Locate the functions.php file in your theme directory.
    • Edit the file using a text editor (preferably one that supports code formatting, such as Notepad++ or VSCode).
  • Add Redirect Code:
    • Add the following code at the end of the functions.php file:

PHP Code
function custom_redirect_404() { if (is_404()) { wp_redirect(home_url(‘/’)); // Replace ‘/’ with the desired URL exit(); } } add_action(‘template_redirect’, ‘custom_redirect_404’);

    • Save the changes to functions.php.
  • Test the Redirection:
    • Open a new browser window or tab and try accessing a non-existent page on your website to check if the redirection is working.

Remember to replace home_url('/') with the actual URL where you want to redirect users in the code snippet.

Using a redirection plugin is recommended for those unfamiliar with coding, as it provides a user-friendly interface. However, if you are comfortable editing theme files and prefer a code-based solution, the second method is suitable. Always make a backup before making changes to theme files.