how to redirect the old domain to the new domain

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Annie_P
    Member
    • Aug 2022
    • 75

    how to redirect the old domain to the new domain

    Hi there! please let me know how to redirect the old domain to the new domain
  • Rachel S
    Member
    • Apr 2022
    • 96

    #2

    About redirects:

    A redirect occurs when a web server switches a visitor from one web page to another. Creating shorter, simpler-to-remember URLs that redirect to larger URLs is a typical application of redirection. Another usage is to route site users from outdated web pages to more recent ones.

    Multiple web pages are redirected using cPanel, and redirections can be either temporary or permanent.

    You can use cPanel to redirect the old domain to the new domain:

    Step 1: log in to your Cpanel account.

    Step 2: Find the "Redirects" function in the "Domains" section.

    Step 3:From the drop-down menu, choose the old domain.

    Step 4: Choose the redirect type (temporary or permanent).

    To specify a permanent redirection, select Permanent (301).
    To specify a temporary redirection, select Temporary (302).

    Step 5: In the "Redirects to" section, type the new domain's whole URL.

    Step 6: Choose the redirect settings (with or without www).

    Step 7: (Optional) Select the "Wild Card Redirect" checkbox to redirect subdomains as well.

    Step 8: Click "Add" to create the redirect.

    Redirecting the old domain to the new domain is a simple process to complete this step.

    Comment

    • nehakakar
      Junior Member
      • Jun 2023
      • 1

      #3
      AccuWeb.Cloud
      Originally posted by Annie_P View Post
      Hi there! please let me know how to redirect the old domain to the new domain
      Hi There

      Here is how you can redirect an old URL to a new one. I will mention the three most popular ways to do it.



      htaccess Redirect file of the old domain.

      Code:
         RewriteEngine On
         RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
         RewriteCond %{HTTP_HOST} ^www.olddomain.com$
         RewriteRule (.*)$ https://newdomain.com/$1 [R=301,L]
      Redirect in Nginx from the old server.


      Code:
         server {
             listen 80;
             server_name olddomain.com www.olddomain.com;
             return 301 https://newdomain.com$request_uri;
         }
      3. Redirect in PHP file on the old domain with the following code.


      Code:
        <?php
         header("HTTP/1.1 301 Moved Permanently");
         header("Location: https://newdomain.com".$_SERVER['REQUEST_URI']);
         exit();
         ?>
      The redirects will permanently redirect all traffic from the old domain to the new domain with a 301 status code, You can verify the URL status code with any online redirect tool alos.
      Last edited by admin; 07-25-2023, 12:08 AM.

      Comment

      Working...
      X