bf sb bg
bf sb logo
Up to 70% OFF* sitewide
Learn more
100% Australian Owned and OperatedSupport Centre13 24 85Pay an InvoiceLOG IN
supportcentre scaled
Support Centre
Find the answers to your questions and get the support you need with the VentraIP help centre.

Create redirects using the .htaccess file

Using the inbuilt cPanel tools

If you’d prefer to add simple redirects, cPanel has an inbuilt redirect tool that will do this for you.

If you want to do anything that is outside of the fairly basic functionality of the cPanel redirect tool, you may want to consider manually editing your .htaccess file to create more advanced redirects.

Adding redirects manually

Your .htaccess files provide a means to make configuration changes in how directories/files route. With this file you can redirect certain requests – such as force visitors to the HTTPS version of your site.

This file is usually located in your public_html directory, as well as the root directory for any add-on or sub-domains. Redirects added this way should be placed at the top of your .htaccess file, as the file itself is read top-down.

Here are a few of the most common uses of these types of redirects:

Force your site to load securely

RewriteEngine On RewriteCond %{HTTPS} !on RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Rewrite a directory to be SSL/HTTPS access only

RewriteEngine On RewriteCond %{SERVER_PORT} !443 RewriteRule ^(.*)$ https://www.mywebsite.com/directory [R,L]

Rewrite a specific file in a directory to be SSL/HTTPS access only

RewriteEngine on RewriteCond %{SERVER_PORT} !443 RewriteRule ^specificfile.php$ https://www.mywebsite.com/directory/specificfile.php [R=301,L]

Rewrite the URL to force visitors to ‘www.’

RewriteEngine On RewriteCond %{HTTP_HOST} !^www.mywebsite.com [NC] RewriteRule ^(.*)$ http://www.mywebsite.com/$1 [R=301,L]

Redirect any request for the root directory to forward to a subdirectory

RewriteEngine on RewriteCond %{HTTP_HOST} www.example.com [NC] RewriteCond $1 !^test/ RewriteRule ^(.*)$ http://www.example.com/test/$1 [L]

Redirect ‘yourdomain.com’ to ‘subdomain.yourdomain.com’

Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain.com RewriteRule ^directory(.*) http://subdomain.yourdomain.com$1 [R=301,L]

Redirect ‘www’ to ‘subdomain.yourdomain.com’

RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC] RewriteRule ^(.*) http://subdomain.yourdomain.com/$1 [R=301,L]

misc content center scaled