How do I set up a redirect to another website?

Marijn Avatar

Publication date

Redirects are an important part of website management and SEO. If you have a new domain name or have redesigned your website, redirects ensure that your visitors and search engines are sent to the right place without errors and loss of traffic. 

In this article, we further explain what redirects are, when to use them, the different types, and how to set up a redirect to another website.

What is a redirect

A redirect is literally translated as a ‘rerouting’. And that’s exactly what it is. A redirect is a way to ensure that a visitor or search engine visiting a specific URL is automatically redirected to another URL. 

This is especially useful when a page has been moved or no longer exists, a website has been restructured, or when you have a new domain name. Redirects ensure that your visitors and search engines reach the right page without error messages or lost information. 

This way, you prevent losing the SEO value of your website and maintain good user-friendliness. 

When do you use a redirect?

Redirects are used in various situations, for example, you might think of:

  • Changing domain name: If you change your domain name, you want to ensure that your visitors are directed to the new site.
  • Deleted pages: If a page no longer exists, you can direct visitors to another relevant new page.
  • Website redesign: If you change the structure of your website, old URLs can be redirected to new locations.
  • A/B testing: For testing different versions of a page.
  • HTTP to HTTPS migration: To ensure that all traffic goes to the secure version of your website.

What types of redirects are there?

There are different types of redirects, each with its own specific application:

301 Redirect (Permanent Redirect)

A 301 redirect is a server-side redirect that indicates a page has permanently moved to a new URL. Search engines will index the new URL and transfer all value and links from the old URL to the new URL, which is important for your SEO.

302 Redirect (Temporary Redirect)

A 302 redirect is a server-side redirect that indicates a page is temporarily moved to a new URL. Search engines will index the new URL and transfer all value and links from the old URL to the new URL.

307 Redirect (Temporary Redirect)

A 307 redirect is a server-side redirect that, like the 302, indicates that a page is temporarily moved. The difference is that a 307 redirect guarantees that the request method (GET or POST) does not change. This is useful for retaining request methods in web applications.

Meta Refresh Redirect

A meta refresh redirect is a client-side redirect executed via an HTML tag in the head section of a page. It can be used for both temporary and permanent redirects but is less SEO-friendly because search engines prefer server-side redirects. A common form is a 5-second delay with a message like “If you are not redirected, click here.”

Advantages and disadvantages of redirects

Advantages:

  • SEO retention Retains the value of backlinks and SEO ranking.
  • User experience: Improves the experience by avoiding broken links.
  • Flexibility: Gives the ability to change URLs and domains without losing traffic.

Disadvantages:

  • Load time: Can affect load times due to additional redirects.
  • Complexity: Requires good planning and implementation to avoid errors.
  • Caching issues: Especially with permanent redirects, caching can cause issues when rolling back.

How to implement redirects?

WordPress

Step 1: Backup your old and new websites

Before you start making changes, we recommend that you make complete backups of both your old and new WordPress website. This ensures that you can restore any errors without losing data.

Step 2: Install and activate a redirect plugin

There are several plugins available for WordPress that can help you easily set up redirects. A popular choice is the “Redirection” plugin. Follow these steps to install and activate the plugin:

  1. Log in to the dashboard of your old WordPress website.
  2. Go to Plugins > New plugin.
  3. Search for “Redirection“.
  4. Click on Install Now and then Activate.

Step 3: Configure the 301 redirects

Now that the plugin is installed, you can start setting up the redirects.

  1. In your WordPress dashboard, go to Tools > Redirection.
  2. Follow the on-screen instructions to complete the initial setup.
  3. Once you have completed the setup, you will see a screen where you can add new redirects.
  4. Add a new redirect for each page of your old website by entering the old URL in the Source URL field and the new URL in the Target URL field. For example:
    • Source URL: /old-page
    • Target URL: https://www.newwebsite.com/new-page

Step 4: Test the redirects

After setting up the redirects, it is important to check if they are working correctly:

  1. Open an incognito window in your browser.
  2. Enter the URLs from your old website and check if they correctly redirect to the new URLs.
  3. Check multiple pages to ensure all redirects are set up correctly.

Step 5: Adjust the .htaccess (optional)

For advanced users, adjusting the .htaccess file can be a faster way to set up multiple redirects at once. This file is located in the root of your WordPress installation. Add the following lines for each redirect:

Redirect 301 /old-page https://www.newwebsite.com/new-page

Ensure that all internal links on your new website are correctly updated to the new URLs. This not only helps with SEO but also ensures that visitors do not encounter broken links.

Step 7: Inform search engines

It is important to inform search engines about the changes. You do this by submitting a sitemap of your new website to Google Search Console and other search engines. This helps search engines quickly index your new content.

  1. Log in to Google Search Console.
  2. Select your new website.
  3. Go to Sitemaps.
  4. Add the URL of your new sitemap and click on Submit.

Step 8: Monitoring and Maintenance

After setting up the redirects, it’s important to monitor them regularly. The Redirection plugin provides a logging function that allows you to see which redirects are being used and if any errors occur. This helps you quickly identify and resolve any issues.

How to Set Up Redirects with the .htaccess File

If you have a website running on an Apache web server, the .htaccess file is one of the better tools at your disposal. You use this file to manage various server configurations on a per-directory basis, including setting up redirects.

What is the .htaccess File?

The .htaccess file, which stands for “hypertext access,” is a configuration file used by the Apache web server to manage specific settings for your website.

This file is hidden, which means it is typically not visible in your file system unless you adjust the settings of your file manager or FTP client to display hidden files. 

The .htaccess file is located in the root directory of your website or in specific subdirectories where you want to apply configurations.

When to Use the .htaccess File?

There are several occasions when you use the .htaccess file. One of the most common is for setting up URL redirects. This is especially useful when migrating a website to a new domain name or restructuring your website. 

By using redirects, you ensure that visitors and search engines are automatically directed from old to new URLs, which is important for maintaining your search engine rankings and providing a good user experience.

Additionally, the .htaccess file is often used for URL rewrites (to create user-friendly URLs), security settings (such as restricting access to certain parts of your website), and adjusting server behavior (for example, by setting up custom error pages or enabling cache-control).

How to Set Up Redirects with the .htaccess File?

Setting up redirects with the .htaccess file is a relatively simple process. First, you need to access your web server via an FTP client like FileZilla or through the file manager of your hosting provider. Make sure you can see hidden files so you can open and edit the .htaccess file.

To set up a 301 redirect (permanent redirection), simply add the following line to your .htaccess file:

Redirect 301 /old-page.html https://www.newwebsite.com/new-page

You repeat this process for each page you want to redirect. This ensures that when someone visits the old URL, they are automatically redirected to the new URL.

Testing and Checking Your Redirects

After setting up the redirects, it’s important to check if they work correctly. Open an incognito window in your browser and enter the URLs of your old website to see if they correctly redirect to the new URLs. Test multiple pages to ensure that all redirects are properly set up.

Informing Search Engines

It’s crucial to inform search engines of the changes. You do this by submitting a sitemap of your new website to Google Search Console and other search engines. This helps search engines quickly index your new content, which contributes to maintaining your SEO performance.

Monitoring and Maintenance

After setting up the redirects, it’s important to monitor them regularly. Check your server logs or use tools like Google Analytics to see if the redirects are being used correctly and if any errors occur. This helps you quickly identify and resolve any issues, which is essential for optimal website performance.

By understanding what the .htaccess file is and how to use it, you can take control of various aspects of your website and improve it. Whether you want to set up redirects, rewrite URLs, or secure your website, the .htaccess file is an essential tool for every webmaster.

Domeinnaam bestellen?

Een goede naam zorgt voor een goede website.


Published on

in

comments

Leave a Reply

Your email address will not be published. Required fields are marked *