I am using the following .htaccess rules to redirect the url for following conditions:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^$ https://example.com/page.php [L,R=301]
- If user enters "https://example.com", he is redirected to "https://example.com/page.php".
- If user enters "www.example.com", he is not redirected to "https://example.com/page.php" but regular "index.php".
Now the issue is, if the user only enters "example.com", he should not be redirected to "https://example.com/page.php" but "index.php".
How can I achieve this functionality?