How to write .htaccess so that https is on for subpages only but not the home page

Presumably your .htaccess file is located in the /abc subdirectory? In which case you can do something like the following to force HTTPS on all sub-pages, except the homepage:

This needs to go at the very top of your .htaccess file:

RewriteCond %{HTTPS} !on
RewriteRule !^(index\.php)?$ https://example.com%{REQUEST_URI} [R=302,L]

This assumes that the SSL cert is installed directly on your application server.

The negated RewriteRule pattern !^(index\.php)?$ only matches non-empty (or not index.php) URL-paths, so this excludes the homepage.

Change the 302 (temporary) to 301 (permanent) only when you are sure it’s working OK, to avoid caching issues. Clear your browser cache before testing.


Aside:

RewriteBase /abc/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /abc/index.php [L]

Since you have set the RewriteBase directive, you can remove the directory-prefix from the RewriteRule substitution (this is what the RewriteBase directive does):

RewriteRule . index.php [L]

However, since your .htaccess file is in the /abc subdirectory, then you don’t actually need the RewriteBase directive or the directory-prefix.