How to Force HTTPS on a Specific Folder

The .htaccess (located in your public_html folder)file can also be used to force HTTPS on specific folders. However, the file should be placed in the folder that will have the HTTPS connection. Add these lines:

 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(folder1|folder2|folder3) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
 
 

Make sure to change the folder references to the actual directory names.

After making the changes, clear your browser’s cache and try to connect to your site via HTTP. If everything was added correctly, the browser will redirect you to the HTTPS version.

  • 0 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

How to Force HTTPS on a Specific Domain

Let’s say that you have two domains: http://yourdomain1.com and http://yourdomain2.com. Both...

How to Force HTTPS Using .htaccess file

After you buy an SSL certificate and install it on your website, it will be available over HTTP...

How to install free cPanel SSL

Log into your cPanel account Locate and click on SSL/TLS Manager in the Security section...