Redirect non www and http to www/https

To redirect your website from http to https or non www to www by just create .htaccess (starting with [dot] or end on ss) name file in your public_html folder of your web hosting directory and paste the following code in this file.
If you are unable to create/edit .htaccess file. This article will show that How to show hidden files (.htaccess) in cPanel File Manager?

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond !{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

  • redirect to https and www
  • 2 utilizatori au considerat informaţia utilă
Răspunsul a fost util?

Articole similare

How to show hidden files (.htaccess) in cPanel File Manager?

Many users ask us how they can see the .htaccess files for their websites in cPanel File Manager....

How Can I Compress / Uncompress Files Using the File Manager?

How to Compress Files Go to the File Manager. Navigate to the folder where the files you want...

How to View Your cPanel Disk Space Usage?

In order to view your cPanel disk space usage, there’s a great tool located inside of your...

Accessing webmail for your domain

To access the included webmail email clients included with your hosting account, you’ll need to...

How to rename a database in phpMyAdmin?

phpMyAdmin is a free and opensource application for MySQL database management. It is one of the...