title: Redirects created at: Thu Oct 17 2024 18:51:58 GMT+0000 (Coordinated Universal Time) updated at: Wed Jul 23 2025 20:19:01 GMT+0000 (Coordinated Universal Time) --- # Redirects # Overview The *Redirects* interface allows you to send all of the visitors of a domain or particular page to a different URL. For example, if you create a page with a long URL, use the *Redirects* interface to add a redirect from a short URL to the long URL. Visitors can enter the short URL to access the content of the long URL. You can also use redirects like this to avoid storing sensitive customer information. For example, payment processors like [Stripe](https://docs.stripe.com/payment-links/create) offer links to secure pages where they process payment information so that you don’t have to store any credit card data. > \[!NOTE] > Note > You **cannot** edit a redirect. To modify a redirect, you **must** delete it and then recreate it. > If you wish to redirect a domain’s visitors from the insecure version of the website to the secure version, use the *Force HTTPS Redirect* option on cPanel’s [*Domains*](https://docs.cpanel.net/cpanel/domains/domains/) interface (*cPanel » Home » Domains » Domains*). # Add a redirect To add a redirect, perform the following actions: 1. Select a redirect type from the *Type* menu. * *Permanent (301)* — This setting notifies the visitor’s browser to update its records. * *Temporary (302)* — This setting does **not** update the visitor’s bookmarks. 2. Select a domain name from the menu, or select ***All Public Domains*** to redirect all of the domains that your cPanel account controls. 3. 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. 4. In the *Redirects* to text box, enter the URL to which you wish to redirect users. > \[!WARNING] > Important\ > You **must** specify a protocol in this text box. For example, `http://`, `https://`, or `ftp://`. 1. Select one of the following settings: * *Only redirect with www.* — This setting only redirects visitors who enter the *www.* prefix before the domain name part of the URL. * *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. * *Do Not Redirect www.* — This setting does **not** redirect users who enter the *www.* prefix before the domain name part of the URL. > \[!NOTE] > The interface disables the *www.* redirection setting if you select ***All Public Domains***. 1. Select the *Wild Card Redirect* setting if you wish to redirect all files within a directory to the same filename in the new directory. For example, if you enable the *Wild Card Redirect* setting and `example1.com` redirects to `example.com`, then a visitor who tries to access the `http://example1.com/pic.jpg` URL redirects to the `http://example.com/pic.jpg` URL. 2. Click *Add*. 3. To test the redirect, click the link under *Directory* in the *Current Redirects* table. If you properly configured the redirect, the system directs you to the original domain. > \[!NOTE] > Note > To add a redirect where the original domain appears in the browser’s address bar, create a subdomain and redirect it to your chosen domain. You can create a subdomain in cPanel’s [*Domains*](https://docs.cpanel.net/cpanel/domains/domains/) interface (*cPanel » Home » Domains » Domains*). ## Redirects via third-party applications When you add a redirect with the cPanel interface, the system places redirect rules at the bottom of the `.htaccess` file. Some third-party applications will ignore your rules because those applications only read rules and configurations that their section of the `.htaccess` file contains. > \[!WARNING] > Important > If you use a third-party application or content management system to add a redirect, such as WordPress, the redirect may not function properly. To avoid this problem, add redirects manually with the instructions above. #### Edit your .htaccess file through the File Manager interface To edit your `.htaccess` file through cPanel’s [*File Manager*](https://docs.cpanel.net/cpanel/files/file-manager/) interface (*cPanel » Home » Files » File Manager*), perform the following steps: 1. Navigate to the interface. 2. In the top navigation bar, click *Settings*. The *Preferences* interface will open. 3. Select *Show Hidden Files (dotfiles)*. 4. Click *Save*. The *Preferences* interface will close. Your `.htaccess` The file will now appear in the `public_html` folder. To learn more about actions you can take through the [*File Manager*](https://docs.cpanel.net/cpanel/files/file-manager/) interface (*cPanel » Home » Files » File Manager*), including editing your files, read our [*File Manager*](https://docs.cpanel.net/cpanel/files/file-manager/#other-item-actions) documentation. #### Redirect configuration example The following example displays the configuration that you must add to the top of the `.htaccess` file to add a redirect for the [Drupal](https://www.drupal.org/) 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. ```bash <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> ``` ## The Current Redirects table The *Current Redirects* table lists the redirections that currently exist on your account. To search for a redirection, enter the search criteria in the *Search* text box and click *Go*. The table lists the following information about redirects: | Label | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | *Domain* | The domain to redirect. *ALL* represents all of the account’s publicly-available domains. | | *Directory* | The directory to redirect. Click the link to test the redirection. | | *Regular Expression* | The system will redirect any URL that matches the regular expression in this column. | | *Redirect URL* | The URL to which you wish to redirect users. | | *HTTP Status Code* | The numerical [HTTP Status Code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) of the redirect. | | Type | - *permanent* — This setting notifies the visitor’s browser to update its records. <br />- *temporary* — This setting does **not** update the visitor’s bookmarks. | | *Match www.* | Only redirect visitors who enter the `www.` prefix before the domain name part of the URL. | | *Wildcard* | Redirect all files within a directory to the same filename in the new directory. For example, if you enable the *Wild Card Redirect* setting and `example1.com` redirects to `example.com`, then a visitor who tries to access the `http://example1.com/pic.jpg` URL redirects to the `http://example.com/pic.jpg` URL. | | *Actions* | Available actions for the redirection:<br />- *Delete* — Delete the redirection. Click *Yes* to confirm the deletion.> \[!WARNING]<br />> Important<br />> Most web browsers add redirections to a cache. Visitors may need to clear their web browser cache to remove the redirection from their web browsers | # Examples ## Permanent redirects The following is a permanent redirect of an entire site from its original location to example.com: ```bash Redirect 301 / http://example.com/ ``` The following is a permanent redirect of a page on example.com to a different page on example.com: ```bash 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: ```bash Redirect 301 /old-directory http://www.example.com/new-directory ``` ## Temporary redirects The following is a temporary redirect of an entire site from its original location to example.com: ```bash Redirect 302 / http://example.com/ ``` The following is a temporary redirect of a page on example.com to a different page on example.com: ```bash 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: ```bash Redirect 302 /old-directory http://www.example.com/new-directory ```