Remove 301 redirects

Updated at:

If your website's domain name changes—for example, if a domain is reclaimed or your site architecture is significantly restructured—you may need to remove existing 301 redirect rules. Failing to do so can make your website inaccessible, negatively impacting user experience and search engine rankings. This topic describes how to find and remove 301 redirects for your Web Hosting instance.

Background

You can configure 301 redirects in the following ways:

  • Web Hosting console: You can configure 301 redirects on the basic environment settings page of the Web Hosting console. For more information, see Set 301 redirects.

  • website configuration file: You can configure redirects by editing the Nginx file (for Web Hosting instances running enhanced Linux operating systems) or the .htaccess file (for instances running standard Linux operating systems).

  • Website application: You can configure redirects in your website's application, for example, by using a plugin.

Procedure

Note

Before you begin, make sure an FTP client is installed. We recommend using FileZilla. For instructions, see Manage website application files by using FileZilla.

This topic uses a WordPress site hosted on a Web Hosting instance running a Linux operating system as an example. The steps to remove a 301 redirect vary depending on how it was configured.

  1. Log on to your WordPress site and check the response header for 301 redirect information.

    1. Visit your WordPress domain in a web browser.

    2. On your WordPress site, press F12 to open your browser's developer tools.

    3. At the top of the developer tools panel, click the Network tab, and then click a file under the Name column.

    4. On the Headers tab, check for a Status Code: 301 xxx field.

      General
      Request URL: http://xxx
      Request Method: GET
      Status Code: 301 Moved Permanently (from disk cache)
      Remote Address: xxx
      Referrer Policy: strict-origin-when-cross-origin
      Response Headers
      Cache-Control: max-age=3600
      Content-Type: text/html; charset=UTF-8
      Date: Mon, 13 Feb 2023 09:53:13 GMT
      Expires: Mon, 13 Feb 2023 10:53:13 GMT
      Location: http://xxx
      Server: nginx
      X-Redirect-By: redirection
      • If the Status Code: 301 xxx field is not present:

        This means no 301 redirect is configured at the application level. Proceed to Step 2 and Step 3 to check the Web Hosting console and the website configuration file.

      • If the Status Code: 301 xxx field is present:

        This means a 301 redirect is configured at the application level. Proceed directly to Step 4 to remove it.

  2. Find and remove the 301 redirect in the Web Hosting console.

    1. Log on to the Web Hosting console.

    2. Find your Web Hosting instance and click manage in the Actions column.

    3. In the navigation pane on the left, choose basic environment settings > 301 redirect.

    4. Check if any 301 redirects are configured.

      • If a redirect is configured: Find the target domain and click delete in the Actions column. In the dialog box that appears, click Confirm.

      • If no redirect is configured: Continue to the next step to check the website configuration file.

  3. Find and remove the 301 redirect in the website configuration file (Nginx file or .htaccess file).

    The Nginx file is available on Web Hosting instances running an enhanced Linux operating system. The .htaccess file is available on instances running a standard Linux operating system.

    Nginx file

    1. Connect to your Web Hosting instance using FileZilla.

      For instructions, see Manage website application files by using FileZilla.

    2. In the website root directory, find and open the Nginx file to check for a 301 redirect configuration.

      If the file contains code similar to the following example, a redirect is configured. Continue to the next step to remove it. Otherwise, no further action is needed.

      location / {
        if ($host = 'old-domain') {
        rewrite ^/(.*)$ http://new-domain.com/$1 permanent;
        }
      }
    3. Remove the 301 redirect.

      1. Log on to the Web Hosting console.

      2. In the navigation pane on the left, choose advanced environment settings > NGINX settings.

      3. Enter the following code in the text box and click Save Settings.

        location / {
        }
        location ~ /\.ht {
            deny all;
        }

    .htaccess file

    1. Connect to your Web Hosting instance using FileZilla.

      For instructions, see Manage website application files by using FileZilla.

    2. In the website root directory, find and open the .htaccess file to check for a 301 redirect configuration.

      If the file contains code similar to the following example, a redirect is configured. Continue to the next step to remove it. Otherwise, no further action is needed.

      Redirect 301 / http://new-domain.com/ 
    3. To remove the 301 redirect, delete the following line of code and save the file.

      Redirect 301 / http://new-domain.com/ 
  4. (Optional) Remove the 301 redirect from your WordPress site.

    Complete this step only if you found an application-level 301 redirect in Step 1.

    1. Log on to your WordPress site and go to the dashboard.

    2. In the navigation pane on the left, choose tools > Redirections.

      Redirections is a plugin for WordPress used to set up 301 redirects. This article uses the Redirections plugin as an example.

    3. On the Redirections page, find the target URL and click delete below it to remove the redirect.

    4. Visit your original WordPress domain again to verify that the 301 redirect is no longer active.

      • If the redirect is no longer active: You have successfully removed it.

      • If the redirect is still active: In the navigation pane on the left, click plugins. Find the Redirections plugin and click deactivate. Then, clear your browser cache and visit the source domain again to test.

        Note

        After testing, you can reactivate the Redirections plugin if needed.