Effortless 301 and 302 Redirects in Linux Hosting: A Detailed cPanel Guide
Introduction
Website redirects play a pivotal role in web development and SEO strategy. Whether you've moved to a new domain or need to streamline user navigation, setting up 301 (permanent) and 302 (temporary) redirects is crucial. This comprehensive guide walks you through setting up and managing 301 and 302 redirects using cPanel in your Linux Hosting account.
Section 1: Accessing cPanel
Login to cPanel: To start, you need to access your cPanel account. You can do this by appending '/cpanel' to your domain name (e.g., https://<your-domain-name>/cpanel) or via the link provided by our Support Team. Use your username and password to log in, as illustrated in Figure 1 below.
You will land on the dashboard page upon successful login, as illustrated in Figure 2 below.
Section 2: Add a Redirect
Go to the Domains section in the dashboard and click on the Redirects link, as illustrated in Figure 3 below.
You will land on the page after clicking the Redirects link, as illustrated in Figure 4 below.
You can add a redirect by the following actions, as illustrated in Figure 4 above.
- Select a redirect type from the Type menu.
a. Permanent (301): This setting notifies the user’s browser to update the records
b. Temporary (302): This setting does not update the user’s bookmarks. - Select a domain name from the menu, or select **All Public Domains** to redirect all of the domains that your cPanel account controls.
- In the next text box, enter the rest of the URL from which you wish for the server to redirect visitors. For example, if you wish to redirect http://example.com/directory.file.html to another URL, enter directory/file.html in this text box.
- In the Redirects to text box, enter the URL to which you wish to redirect users, and select one of the following settings:
a. Only redirect with www: This setting only redirects visitors who enter the www. prefix before the domain name part of the URL.
b. Redirect with or without www: This setting redirects all users, regardless of whether the visitor enters the www. prefix before the domain name part of the URL.
c. Do Not Redirect www: This setting does not redirect users who enter the www. prefix before the domain name part of the URL. - Select the Wild Card Redirect radio button setting if you want to redirect all files within a directory to the same filename in the new directory. (i.e., if you enable the Wild Card Redirect setting and abc1.com redirects to abc.com, then the visitor who tries to access the http://abc1.com/image.jpg URL will redirect to the http://abc.com/image.jpg URL.
- Click the Add button to save the changes.
Conclusion
Creating 301 and 302 redirects in your Linux Hosting account using cPanel is more straightforward than you might think. With this step-by-step guide, you're now equipped to manage redirects efficiently, improving user experience and SEO ranking.