Boost recurring donations this giving season with the new upsell prompt!Learn How >>

Create a redirect for "404 - File not found" errors

updated

A 404 error message occurs when the user tries to view a page that does not exist, and they are given a "404 - File not found error". Your site probably already uses the standard Joomla 404 error page, but if you’d like to customize what happens when somebody types in a bad URL, the redirect component is the tool for you.

There are three ways to customize your 404 Redirect (instructions below):

1. Link to homepage: Incorrect URLs will be redirected to your homepage.

2. Link to search page: Incorrect URLs will be redirected to your search page.

3. Link to custom page: Incorrect URLs will be redirected to a custom content page. This page could tell the user that the content they are looking for cannot be found, with links to the homepage and a search page, etc.

Link to Homepage:

1. To begin, go to Extensions > Plugin Manager.

2. You are looking for the plugin titled “System – Redirects”. It is probably easiest to just type “Redirects” into the Filter field and click Go. You should see something like this:

filter.jpg

3. Click the title of the plugin to reach the editing menu.

4. In the editing menu, you’ll see a number of settings under “Details”, these should be left alone. The only field that you’ll need to change is “Page Not Found” under parameters on the right. It should look something like this:

parameters.jpg

5. In this field, enter "index.php", this will tell the server to send all 404 redirects to your homepage. It should look like this:

index.jpg

6.Click Save

7. Your 404 Redirect should work now, try navigating to a bad url to see if it takes you to your homepage. (http://www.yourdomain.org/asdfg for example)

Link to search page:

Follow the same instructions as for the ‘link to homepage’ above. When you reach step 5, instead of entering "index.php" for your homepage, you can enter the URL of your search page. It is best to use the relative URL for your search page. That means you only want to include the part after "yourdomain.org/". For example, if your search page is found at http://www.yourdomain.org/about/search, then you would just need to put "about/search" into the field.

Link to custom page:

1. You will need to create a new content item by going to Content > Article Manager > New

2. You’ll want to give your custom page a title, like “404 – Page Not Found”, or something to that effect. You can leave both the Section and the Category as Uncategorized

3. You’ll want to enter whatever content that you’d like people to see in the content window. For a great example of a custom redirect page, check out Prevention Institute at http://www.preventioninstitute.org/hjk

4. Now that you’ve created the custom content for your redirect page, click Save in the upper right hand corner 

5. We’ll need to create a menu item to get to the content page in the front end. However, we are not going to publish the menu item because we don’t want it to be a navigable destination in our web site’s menu.

6. Go to Menus > Main Menu

7. Click New

8. Click Articles > Article Layout

9. In the menu editor, you’ll need to give your menu item a title, something like “404 – Page Not Found” would work:

menutitle.jpg

10. You’ll also need to tell the menu item to point to your custom content item, using the “Select Article” tool, click the “select” button:

select.jpg

11. This will pop up the article selector box, find your article and click it’s title to select it:

article.jpg

12. You’ll also need to set the “Published” Field to “No”, because we won’t actually need a public menu item to this content page.

unpub.jpg

13. Now that you’ve given your menu item a title, selected your content item, and made sure it was unpublished, please click the “Apply” button. 

14. Because you clicked the apply button, it should save this menu item, but keep you in the menu editor. Now that your menu item has been saved, there will be a correct link in the “link” field, it should look like this:

link.jpg

15. Please COPY the full url found in that field. It should look something like this:

index.php?option=com_content&view=article&id=19

16. This is the URL of your custom 404 page. You’ll want to save this URL somewhere because you’ll need it later. Now you can hit close in the upper right of the menu editor. 

17. Now, you’ll need to set the redirects plugin to send all 404 errors to this page, to do this, follow these steps:

1. To begin, go to Extensions > Plugin Manager.

2. You are looking for the plugin titled “System – Redirects”. It is probably easiest to just type “Redirects” into the “Filter” field and click “Go”. You should see something like this:

filter.jpg

3. Click the title of the plugin to reach the editing menu.

4. In the editing menu, you’ll see a number of settings under “Details”, these should be left alone. The only field that you’ll need to change is “Page Not Found” under parameters on the right. It should look something like this:

parameters.jpg

5. In this field, paste the URL that we created earlier in step 12 and click save.

6. Your 404 Redirect should work now, try navigating to a bad url (For example: http://www.yourdomain.org/asdfg) to see if it takes you to your homepage.

Have more questions? Submit a request
Article is closed for comments.