Moorfleeter Deich 216, 22113 Hamburg
+49 1774661716info@bastcom.deMon–Fri: 09:00–18:00

Blog

ITWeb Knowledge

Tech news, AI and practical knowledge – around WordPress, Joomla, hosting and web development.

Domain redirection for Joomla

← Back to the blog

Introduction

When a website is relaunched or content is restructured, URLs often change, which can lead to old links running into the void. As a result, pages already indexed by search engines receive a 404 error (page not found), while new pages need to be indexed again. To avoid negative effects on SEO ranking and user experience, outdated URLs should be forwarded correctly. In this guide, you will learn how to reliably redirect old URLs to new pages or set up a custom error page with Joomla.

1. Forwarding outdated URLs in Joomla

Joomla offers an integrated function for redirecting URLs, but this is often not sufficient. A more efficient solution is the script-driven redirection via its own PHP script.

Domain redirection with “error.php”

Our solution is based on two files:

  • error.php – A PHP script for detecting and forwarding 404 errors
  • errorlist.txt – A configuration file with old and new URLs

The script detects when a page called no longer exists and automatically redirects to the corresponding new URL (status code 301). If there is no replacement, a custom 404 error page is displayed.

2. Setting up the redirects

Before uploading the files to the server, the old URLs must be errorlist.txt are registered:

/alte/url.html : /neue/url.html

Example:

/kontakt-alt.html : /kontakt.html
/produkte.html : /unsere-produkte.html

The files are then uploaded to the template directory of Joomla.

3. Setting up your own 404 error page

If there are no new URLs for outdated pages, it is recommended to create a custom 404 page:

  1. Create a new entry for the bug page in Joomla.
  2. Add links to the start page or important subpages.
  3. Create a hidden menu and create a menu item for the error page.
  4. Enter the path to the error page in the file error.php One.

4. Identifying outdated URLs

To capture all old URLs, you can use different methods:

  • Checking the old website before relaunching
  • Use of Google search operators (site:ihredomain.de)
  • Google Search Console (Crawling error under “Diagnosis”)
  • SEO tools like Xovi or Sistrix for analysis of backlinks

Use this method to ensure that all important old URLs are forwarded to the new content.

Conclusion

By redirecting outdated URLs you not only improve user-friendliness, but also get the SEO ranking of your website. error.php-Method and its own 404 page ensure that visitors are always directed to relevant content.