Htaccess redirection for 3 domains in same webserver host

I have a webserver shared hosting and 3 domains pointing to it. I need a htaccess file that will redirect 3 domains to specific url with https
Example: The domains are

  1. http://mydomain1.com
  2. http://mydomain2.com
  3. http://mydomain3.com

I want that if someone types in http://mydomain1.com should redirect to https://mydomain1.com.index.php
I want that if someone types in http://mydomain2.com should redirect to https://mydomain2.com/index.php
I want that if someone types in http://mydomain3.com should redirect to http://mydomain3.com/package1.php (without https://)

I have SSL for mydomain1.com and mydomain2.com, while mydomain3.com doesn’t have a SSL.

Please help me out and provide me a .htaccess file that I need to place in server root.
I am a novice and do not have any idea.
Thanks and regards in advance,
Victor

Victor,

Ignoring the www’s, eh?

RewriteEngine on
RewriteCond %{HTTP_HOST} (mydomain1|domain2)\\.com [NC]
RewriteRule ^$ https://%1.com/index.php [R=301,L]

RewriteCond %{HTTP_HOST} mydomain3\\.com [NC]
RewriteRule ^$ package1.php [L]

That will do precisely what you asked for (except mydomain1.com.index.php which I assume was a typo). It does NOT enforce https on scripts on mydomain1 or mydomain2 but you didn’t ask for that.

As for more generic code, that can be found in my signature’s link with other sample codes - you’ll merely need to add the RewriteCond for your domain name for them to work ONLY on specific domains.

Regards,

DK