To create a domain redirect using either a 301 or 302 status code, follow the steps below:
Log in to your cPanel account.
Go to the "Domains" section and click on the "Redirects" icon.
In the "Add Redirect" section, select the type of redirect you want to create from the "Type" drop-down list.
301 Permanent Redirect: This type of redirect is used when you want to permanently redirect one domain to another. It is recommended to use a 301 redirect if you want to pass on the link juice and SEO value of the old domain to the new domain.
302 Temporary Redirect: This type of redirect is used when you want to temporarily redirect one domain to another. It is recommended to use a 302 redirect if you plan to switch back to the original domain at some point.
In the "Redirects to" field, enter the URL of the domain or page you want to redirect to.
If you want to redirect only a specific page or directory, enter the path of that page or directory in the "Redirects to" field, followed by the URL of the domain you want to redirect to. For example, if you want to redirect "example.com/blog" to "newexample.com", you would enter "newexample.com" in the "Redirects to" field and "blog" in the "Redirects to URL" field.
Select the domain you want to redirect from the "http://" or "https://" drop-down list.
If you want to redirect all pages under the domain, leave the "Redirects to URL" field blank. Otherwise, enter the path of the specific page or directory you want to redirect.
Select the redirect option that best suits your needs from the "Redirect with or without www" drop-down list. This option determines whether the redirect will include or exclude the "www" prefix in the URL.
Click on the "Add" button to create the redirect.
You will see a message that says "Success: Redirects Added". This means that the redirect has been successfully created.
Note: It may take up to 24 hours for the redirect to become fully active due to DNS propagation.