> ## Content Index
> Fetch the complete content index at: https://blog.esadax.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Force HTTPS Using .htaccess in cPanel
- URL: https://blog.esadax.com/en/how-to-force-https-using-htaccess-in-cpanel/
- Published: 2026-11-15T04:16:16.000Z
- Updated: 2026-11-15T04:16:16.000Z
- Author: Esadax 
- Tags: #tr-faq-06-ssl-how-to-force-https-using-htaccess-file-in-cpanel, #en, #mdx-imported, FAQ

To set up an HTTPS redirect for all instances of `index.html` across various subfolders, follow these steps:

1. **Enable RewriteEngine**: This is necessary for Apache to process rewrite rules.
2. **Check for Non-HTTPS Request**: Ensure the request isn't already secure to avoid unnecessary redirects.
3. **Match Exact Filename**: Use a condition to check if the requested file is exactly `index.html`.
4. **Redirect to HTTPS**: Construct the redirect URL using the same host and URI, appending any subfolder paths captured by `(.*)`.

Here's the complete rewrite rule:

```plaintext
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_FILENAME} index\.html
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

```