How to Configure Redirects Manually in cPanel Using .htaccess

This guide explains when and why you should configure redirects manually in your .htaccess file, how to access and edit the file in cPanel, and provides clear examples of 301, 302, and CMS‑specific redirects such as Drupal. Manual redirects are essential when third‑party applications override or ignore cPanel’s default redirect rules.

manual redirects cPanelhtaccess redirect rules301 302 redirect examples

~2 min read · Updated Feb 18, 2026

1. Overview


A redirect automatically sends users from one URL to another. While cPanel’s Redirects interface is usually sufficient, some applications require manual configuration inside the .htaccess file.


2. When Manual Redirects Are Necessary


Manual redirects may be required in the following situations:


  • A third‑party application only reads rules inside its own .htaccess block.
  • A CMS (such as WordPress) overrides or conflicts with redirects created in cPanel.
  • Redirects fail due to rule order or application‑specific requirements.

3. How to Edit Your .htaccess File


To manually edit your .htaccess file, follow these steps:


  1. Open cPanel → File Manager.
  2. Click Settings in the top-right corner.
  3. Enable Show Hidden Files (dotfiles).
  4. Click Save.
  5. Locate the .htaccess file inside the public_html directory.

You can now edit the file directly using File Manager’s built‑in editor.


4. Examples of Manual Redirects


4.1 301 Permanent Redirects


Redirect an entire site:

Redirect 301 / http://example.com/

Redirect a single page:

Redirect 301 /original.html http://www.example.com/new.html

Redirect a directory:

Redirect 301 /old-directory http://www.example.com/new-directory

4.2 302 Temporary Redirects


Temporary redirect for an entire site:

Redirect 302 / http://example.com/

Temporary redirect for a page:

Redirect 302 /original.html http://www.example.com/new.html

Temporary redirect for a directory:

Redirect 302 /old-directory http://www.example.com/new-directory

4.3 Drupal Redirect Example


Some CMS platforms, such as Drupal, require redirect rules to be placed at the top of the .htaccess file. Example:


<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^index\.php$ - [L]

RewriteCond %{HTTP_HOST} ^drupal\.user\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.drupal\.user\.example\.com$
RewriteRule ^cptest$ "http://cpanel.net/" [R=301,L]
</IfModule>

In this example:

  • drupal.user.example.com is the URL being redirected.
  • http://cpanel.net/ is the destination URL.

5. Conclusion


Manual redirects give you full control over URL behavior, especially when working with CMS platforms or applications that override cPanel’s default redirect rules. By editing your .htaccess file directly, you can ensure your redirects function exactly as intended.


Written & researched by Dr. Shahin Siami

Related Articles

How to Restore Your cPanel Account: A Complete Guide for New System Administrators

This guide explains how new system administrators can restore a cPanel account using WHM, transfer accounts and configurations between servers, and enable diagnostic logging for transfer and restore operations. It covers essential concepts such as WHM vs. cPanel, root access, backup handling, SFTP uploads, transfer methods, and advanced debugging tools.

Continue

آموزش کامل انتقال تمام اکانت‌های cPanel از یک سرور به سرور دیگر

این مقاله نحوه انتقال همه اکانت‌های cPanel، تنظیمات سرویس‌ها، گواهی‌های SSL و IP اصلی سرور را از یک سرور قدیمی (Source) به یک سرور جدید (Target) توضیح می‌دهد. شامل نصب سرور جدید، انتقال تنظیمات، انتقال اکانت‌ها، تغییر IP، تنظیم DNS و نصب مجدد SSL است.

Continue

How to Migrate a WordPress® Installation to a cPanel & WHM Server

This guide explains how to migrate a WordPress installation from a macOS-hosted environment to a cPanel & WHM server. It covers exporting the database, uploading WordPress files, creating and importing a MySQL database, updating URLs, configuring wp-config.php, fixing broken links, and finalizing the migration.

Continue

How to Manually Transfer an Account Between Servers in cPanel & WHM

This article explains how to manually transfer a cPanel account between servers when the account is too large for WHM’s automated transfer tools. It covers creating temporary directories, compressing public_html and log files, securely transferring data with SCP, and restoring the files on the destination server.

Continue

How to Manually Migrate Horde Calendars and Contacts to Roundcube in cPanel & WHM

This article explains how to manually migrate Horde calendars and contacts to Roundcube in cPanel & WHM version 108 through 118. It covers exporting Horde data, placing it in the correct directories, and importing it into Roundcube using built‑in plugins or manual import tools.

Continue

How to Manually Migrate Accounts to cPanel & WHM from Unsupported Control Panels

This article explains how experienced system administrators can manually migrate accounts from unsupported third‑party control panels to cPanel & WHM. It covers pre‑migration steps, installation requirements, file and directory transfers, database restoration, SSL migration, and post‑migration tasks.

Continue