How to Set Up Domain Redirects in cPanel: 301 vs 302 Redirection & Wildcard Guide

Configuring domain redirects in cPanel dashboard: 301 vs 302 redirection guide



Quick Answer: Procedural Guide

⚡ cPanel & Apache Verified

How to Set Up Domain Redirects in cPanel: Quick Answer

Direct Answer: To set up domain redirects in cPanel: log in to your cPanel dashboard, navigate to Domains > Redirects, and select your redirect Type (Permanent 301 for domain migrations, or Temporary 302 for maintenance). Select your source domain, enter the full destination URL including https://, choose your www. preference, and click Add.

💡 Key Takeaway: For permanent domain moves or SSL migrations, always choose a 301 Permanent Redirect with Wildcard Redirect enabled to preserve search engine rankings and forward internal page paths 1:1.

301 vs 302
HTTP Redirection Types
Permanent PageRank transfer vs temporary maintenance routing
1:1 Path
Wildcard Mapping
Preserves complete URL hierarchies across domain migrations
99%+
Link Equity Preservation
Direct canonical routing eliminates crawl waste & ranking loss

When migrating a website, rebranding a business domain, or restructuring directory paths, maintaining unbroken user access and safeguarding hard-earned search engine rankings depends heavily on URL redirection. Learning how to set up domain redirects in cPanel gives website owners, digital agencies, and systems administrators the tools to route incoming web traffic smoothly while transferring critical link equity (PageRank) to fresh canonical destinations.

cPanel provides an intuitive graphical interface backed by Apache’s battle-tested mod_rewrite and mod_alias modules. Whether you are executing a permanent 301 migration, configuring temporary 302 maintenance routing, or enforcing wildcard directory mappings, understanding how cPanel writes directives to your document root .htaccess file ensures flawless technical execution without cascading redirect loops.

Understanding Domain Redirects: HTTP Status Codes & Protocols

At the transport protocol layer, a URL redirect is an automated HTTP instruction issued by a web server telling a requesting user-agent (such as Googlebot or a web browser) that the requested resource is located at a different address. According to the official RFC 9110 HTTP Semantics specification, redirects belong to the 3xx class of status responses.

When hosting on high-performance enterprise Linux web hosting stacks running Apache or LiteSpeed, the server responds with a 3xx status header and includes a Location: https://targetdomain.com/ header directive. The client browser reads this response and automatically initiates a second HTTP request to the designated target address without manual user intervention.

The two primary redirection types used in cPanel environments are:

  • 301 Moved Permanently: Notifies client browsers to cache the redirection permanently and tells search engine crawlers that the old URL is obsolete. The search engine transfers accumulated indexing metrics, backlink authority, and PageRank to the destination.
  • 302 Found (Temporary): Informs clients that the resource temporarily resides at a different location. Browsers do not cache this response permanently, and search engines retain the original URL in their search index.

The SEO Importance of 301 Permanent vs 302 Temporary Redirects

Choosing the incorrect redirection code can severely compromise your organic search visibility. When site migrations or brand consolidations are executed using 302 temporary redirects, search engines assume the legacy URL will return shortly. Consequently, link equity remains tethered to the decommissioned address, leaving the new destination URL struggling to rank.

HTTP Status Code Redirection Type Browser Caching Behavior Search Engine Link Equity Recommended Production Use Case
301 Moved Permanently Permanent Redirect Aggressive local disk cache Transfers 95% – 99%+ of PageRank Domain migrations, SSL enforcement, deleted URL forwarding
302 Found Temporary Redirect No persistent browser cache Retains equity on source URL A/B testing, temporary server maintenance, seasonal promotions
307 Temporary Redirect Strict Temporary Zero client cache None (Preserves request method) Post-form submission payment gateway redirection
308 Permanent Redirect Strict Permanent Aggressive local disk cache Transfers full PageRank (Preserves method) Modern REST API endpoint migrations

Step-by-Step Guide: Configuring Domain Redirects in cPanel

Whether you manage domains on shared cPanel accounts or dedicated server partitions, deploying redirects through the graphical interface takes only moments. Follow this step-by-step procedure on managed cPanel web hosting solutions:

Step 1: Accessing the Redirects Management Screen

Log in to your cPanel dashboard via your secure port (typically https://yourdomain.com:2083). Scroll to the Domains section and click on the Redirects icon. Refer to the official cPanel Redirects documentation for version-specific interface nuances.

Step 2: Selecting the Redirection Type

In the Type dropdown menu, choose between Permanent (301) or Temporary (302). For all permanent rebrands, site moves, and dead link corrections, select Permanent (301).

Step 3: Selecting the Source Domain and Subdirectory

Select the domain you wish to forward from the https?://(www.)? dropdown menu. If you wish to redirect the entire root domain, leave the adjacent text field blank. If you only want to redirect a specific subdirectory (e.g., olddomain.com/shop/), enter the directory slug into the text box.

Step 4: Specifying the Destination Target URL

In the Redirects to field, enter the complete destination URL. You must explicitly include the protocol prefix (e.g., https://newdomain.com/). Failing to include https:// can cause cPanel to interpret the destination as a local file directory, producing a broken relative URL loop.

Step 5: Configuring www. Redirection Options

cPanel provides three distinct hostname handling modes:

  • Only redirect with www.: Forwards requests only if visitors explicitly type www.source.com.
  • Redirect with or without www.: Recommended setting. Forwards both naked domain requests and www requests to the target destination.
  • Do Not Redirect www.: Forwards naked domain traffic while leaving www.source.com unbound.

Step 6: Configuring Wildcard Redirection and Saving

Check the Wildcard Redirect box if you want deep subpage forwarding. Finally, click the blue Add button. cPanel will validate your input and immediately inject the corresponding Apache directives into your document root configuration.

Wildcard Redirects: Forwarding Directory Hierarchies & Deep URLs

When restructuring an established website registered through domain name registration services, standard root redirection drops all inbound subpage visitors onto the new homepage. This creates a frustrating user experience and causes search engines to log soft-404 errors on deep product URLs.

💡 Wildcard Redirection Advantage: Wildcard redirection maps file paths 1:1. For example, a request for olddomain.com/catalog/item-452 automatically forwards to newdomain.com/catalog/item-452.

Under the hood, enabling the Wildcard checkbox instructs Apache’s mod_rewrite engine to capture all trailing path segments using regular expression capture groups:




Apache mod_rewrite Wildcard Directive

APACHE CONFIG

# RewriteRule syntax generated by cPanel Wildcard Redirect
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule ^(.*)$ "https\:\/\/newdomain\.com\/$1" [R=301,L]

How cPanel Modifies .htaccess: Directives & Loop Debugging

cPanel writes all domain redirection logic directly to the .htaccess file located in the source domain’s document root (typically /public_html). To inspect or debug these directives, use cPanel File Manager (with “Show Hidden Files” enabled) or connect via SSH terminal on your high-performance Linux Cloud VPS. Consult official Apache mod_rewrite documentation when customizing complex conditions.

cPanel comments its auto-generated rules with distinct demarcation markers:

# BEGIN cPanel-generated redirects
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule ^(.*)$ "https\:\/\/newdomain\.com\/$1" [R=301,L]
# END cPanel-generated redirects

Resolving ERR_TOO_MANY_REDIRECTS Loops

The dreaded ERR_TOO_MANY_REDIRECTS browser error occurs when a request enters an infinite circular loop. Common scenarios include:

  • Self-Referential Directives: Accidentally configuring example.com to redirect to example.com.
  • CMS Conflict: cPanel enforcing www while WordPress Settings (General > Site Address) enforce non-www, causing Apache and WordPress to endlessly bounce requests between hostnames.
  • Cloudflare SSL Mismatch: Using Cloudflare “Flexible SSL” while your origin server enforces HTTPS redirection on port 443. For advanced support, consult our WHM cPanel server support services.

Enterprise Best Practices: Avoiding Redirect Chains & Latency

In enterprise web architecture, redirection speed directly influences search engine crawling efficiency and user conversion rates. Each redirection hop introduces an additional round-trip DNS resolution, TCP handshake, and TLS negotiation, adding 150ms to 400ms of latency to your Time to First Byte (TTFB).

🚫 Eliminate Redirect Chains

Avoid multi-hop chains (e.g., HTTP > HTTPS > non-www > final domain). Always route incoming requests directly to the final canonical URL in a single 301 hop.

🔍 Audit via cURL Terminal

Test redirection headers from the command line using curl -IL https://yourdomain.com to verify clean 301 status codes without browser cache interference.

🗺️ Update XML Sitemaps

Never include redirected URLs inside your active XML sitemaps. Sitemaps should contain 100% 200-OK canonical URLs to optimize Googlebot crawl budget.

🛡️ HSTS Preload Compatibility

Ensure HTTPS redirections comply with HTTP Strict Transport Security (HSTS) headers to guarantee secure, encrypted handshakes across modern browsers.

Frequently Asked Questions: cPanel Domain Redirects

Q1
What is the difference between a 301 permanent redirect and a 302 temporary redirect in cPanel?



A 301 Permanent Redirect indicates that the requested URL has permanently moved to a new destination. It instructs browsers to cache the destination URL locally and tells search engine bots (like Googlebot) to transfer indexed rankings, link equity (PageRank), and canonical signals to the new URL. Conversely, a 302 Temporary Redirect signals that the move is short-term; search engines keep the original URL indexed and browsers do not cache the redirect permanently, making it ideal for temporary maintenance or seasonal A/B testing.

Q2
How does a Wildcard Redirect work in cPanel and when should I enable it?



A Wildcard Redirect in cPanel maps an entire domain’s folder and file hierarchy to the exact same paths on the destination domain. For instance, olddomain.com/blog/article automatically redirects to newdomain.com/blog/article rather than routing every visitor to newdomain.com/. Enable Wildcard Redirection when you are migrating an existing domain to a new domain name where the internal URL slug structure remains identical.

Q3
Where does cPanel save domain redirect configurations on the server?



cPanel writes domain redirection rules directly to the hidden .htaccess file located in the document root directory of the source domain (typically /public_html for primary domains, or /public_html/subfolder for add-on domains and subdomains). The directives are placed inside a specific comment block designated as # BEGIN cPanel-generated redirects.

Q4
Why does my cPanel redirect cause an ERR_TOO_MANY_REDIRECTS loop error?



An ERR_TOO_MANY_REDIRECTS error occurs when a redirection rule forwards traffic in an infinite cycle (e.g., Domain A redirects to Domain B, while Domain B or an internal CMS setting redirects back to Domain A). Common triggers include redirecting a domain to itself, conflicts between cPanel’s www. redirection settings and WordPress’s Site URL settings, or conflicting Cloudflare SSL/TLS encryption modes.

Q5
Does setting up a 301 redirect in cPanel pass 100% of SEO link equity?



According to Google’s official documentation, a 301 Permanent Redirect passes approximately the same link equity (PageRank) as a direct hyperlink—close to 95–99% of historical authority. To prevent equity loss, ensure that redirects point directly to the final canonical destination without intermediate redirect hops or protocol chains (http to https to www to non-www).

Executive Hosting Infrastructure Decision

Optimize Your Web Hosting Infrastructure with Onlive Server

Manage domains, automate 301 redirects, and deliver lightning-fast page loads with Onlive Server’s high-performance NVMe cloud and dedicated hosting environments.

AGILE CLOUD SCALABILITY

Managed Pure NVMe Cloud VPS

Optimized for expanding web applications, multi-domain hosting, automated cPanel management, and fast LiteSpeed/Apache HTTP redirection performance.

  • Pre-Installed cPanel & WHM Control Panel
  • High-Speed Pure Enterprise NVMe SSD Storage
  • Full Root SSH Access with 1 Gbps High-Speed Network

Deploy Cloud VPS with cPanel →

ENTERPRISE BARE-METAL

Dedicated Bare-Metal Server

Engineered for high-volume enterprise traffic, high-concurrency redirect gateways, large eCommerce platforms, and 100% dedicated hardware isolation.

  • High-Frequency Intel Xeon & AMD EPYC Processors
  • Hardware RAID NVMe Storage Arrays with Hot-Swap
  • Custom Anti-DDoS Protection & 100% Dedicated Uplinks

Explore Dedicated Servers →

🛡️ 99.9% Network & Hardware Uptime SLA
⚡ Automated cPanel Domain & SSL Tools
👨‍💻 24/7/365 On-Site Technical Linux Support
🚀 Enterprise NVMe Speed & Data Reliability