Hello, on the Apache server IP is installed SSL certificate for domain1.com, but other domains when not having certifficate and accessed via https, are redirecting to the domain1.com I can install SSL for all domains to prevent this, or use multiple IPs maybe, but i would rather use this way: The primary SSL domain for the server IP will have .htaccess (or index.php?) in its root to redirect all visitor back from where they come, only it will redirect to HTTP(not HTTPS), please how this htaccess or php rule would look like? http://domain0.com OK https://domain0.com --> https://domain1.com BAD Let domain1.com htaccess or index.php redirect visitor back to domain0.com: if referer contains https, then redirect back to referrer only replace https by http Code (markup): I was told there is no way to define this in the Apache, httpd.conf or such. This .php code seems to be working, but unsure if its good: <?php $referer = $_SERVER["HTTP_REFERER"]; $destination = str_replace("https", "http", $referer); if (strpos($referer, 'https') !== false) { header("Location:". $destination); die(); } else { echo "http referer"; } ?> PHP: Thx
This worked, add following to the .htaccess file of the domain to which rest of the domains are redirected: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} =on RewriteCond %{HTTP_HOST} !^yourdomain.com RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L] </IfModule> Code (markup): change yourdomain.com to become domain to which rest of domains are redirected