How to Configure Redirects Manually
Last modified: 2025 July 23
Overview
This document explains how to configure a redirect manually. A redirect automatically sends users from one website to another.
While you can usually use cPanel’s Redirects interface (cPanel » Home » Domains » Redirects) to create your redirect, some third-party applications require you to configure your .htaccess
file manually.
Why you might need to set up a redirect manually
When you add a redirect with the cPanel Redirects interface (cPanel » Home » Domains » Redirects), the system places redirect rules at the bottom of the .htaccess
file. Some third-party applications will ignore your rules and will only read the rules and configurations in their section of the .htaccess
file].
Additionally, redirects added by a third-party application or content management system, such as WordPress®, may not function properly.
When this happens, you may need to configure your redirects manually.
Edit your .htaccess file through the File Manager interface
To edit your .htaccess
file, perform the following steps:
- Navigate to cPanel’s File Manager interface (cPanel » Home » Files » File Manager) interface.
- In the top navigation bar, click Settings. The Preferences interface will open.
- Select Show Hidden Files (dotfiles).
- Click Save. The Preferences interface will close.
Your .htaccess
file will now appear in the public_html
folder.
To learn more about actions you can perform in cPanel’s File Manager interface (cPanel » Home » Files » File Manager), including editing your files, read our File Manager documentation.
Examples
Use the following examples to configure your redirects manually in your .htaccess
file.
301 Permanent redirects
The following is a permanent redirect of an entire site from its original location to example.com:
Redirect 301 / http://example.com/
The following is a permanent redirect of a page on example.com to a different page on example.com:
Redirect 301 /original.html http://www.example.com/new.html
The following is a permanent redirect of an entire directory on example.com to a different directory on example.com:
Redirect 301 /old-directory http://www.example.com/new-directory
302 Temporary redirects
The following is a temporary redirect of an entire site from its original location to example.com:
Redirect 302 / http://example.com/
The following is a temporary redirect of a page on example.com to a different page on example.com:
Redirect 302 /original.html http://www.example.com/new.html
The following is a temporary redirect of an entire directory on example.com to a different directory on example.com:
Redirect 302 /old-directory http://www.example.com/new-directory
Redirect Drupal
The following example displays the configuration that you must add to the top of the .htaccess
file to add a redirect for the Drupal content management system. In this example:
drupal.user.example.com
represents the URL to redirect.http://cpanel.net/
represents the URL to which to redirect.
|
|