How to Forward www.yourdomain.com to yourdomain.com Using cPanel?
Forwarding traffic from `www.yourdomain.com` to `yourdomain.com` is an important step to ensure that all visitors reach the correct version of your website. This process can be easily done through cPanel. Here's how you can set it up:
#### Step 1: Access Your cPanel Account
1. **Log in to cPanel**:
- Go to the URL provided by your hosting provider to access cPanel (e.g., `yourdomain.com/cpanel`).
- Enter your username and password to log in.
#### Step 2: Navigate to the Redirects Section
1. **Find the Redirects Option**:
- In the cPanel dashboard, locate the "Domains" section.
- Click on "Redirects" to access the URL redirection settings.
#### Step 3: Set Up the Redirect
1. **Choose the Redirect Type**:
- Under "Type," select "Permanent (301)" from the dropdown menu. This type of redirect is recommended as it tells search engines that the URL has permanently moved.
2. **Specify the Domain**:
- In the "https?://(www.)?" dropdown, select your domain name from the list. If you want to redirect only the `www` version, select the specific option that includes `www.yourdomain.com`.
- In the adjacent text box, leave it blank to redirect the entire domain.
3. **Enter the Destination URL**:
- In the "Redirects to" field, enter `https://yourdomain.com` (without the `www` prefix).
- Ensure that "www. Redirect" is set to "Only redirect with www."
4. **Apply Wild Card Redirect** (Optional):
- If you want to redirect all files within the domain (e.g., `www.yourdomain.com/page1` to `yourdomain.com/page1`), check the "Wild Card Redirect" box.
5. **Save the Redirect**:
- Click "Add" to save your redirect settings.
#### Step 4: Test the Redirect
1. **Verify the Redirect**:
- Open a web browser and enter `www.yourdomain.com`.
- The browser should automatically redirect to `yourdomain.com`.
2. **Cross-Browser Testing**:
- Test the redirect on different browsers and devices to ensure it works consistently.
### Additional Tips
- **Search Engine Optimization**:
- A 301 redirect is crucial for SEO as it preserves your search engine rankings by transferring the SEO value from the old URL (`www.yourdomain.com`) to the new one (`yourdomain.com`).
- **SSL Considerations**:
- If your site uses HTTPS, make sure that the redirect applies to both `http://www.yourdomain.com` and `https://www.yourdomain.com`.
- **Monitor for Errors**:
- After setting up the redirect, monitor your site’s traffic and error logs to ensure that users are being properly redirected without any issues.
By following these steps, you can successfully redirect traffic from `www.yourdomain.com` to `yourdomain.com`, ensuring a consistent and professional online presence.