Reputation: 2329
I have a laravel website and i forced HTTPS from .htaccess and i access the website though https://leadersuae.net .. now i need to access same website from another domain that doesn't have SSL certificate and the domain http://leadersuae.ae How can i achieve that from .htaccess file because when i open http://leadersuae.ae of course the website if forced to HTTPS already .. so i need to force HTTPS for the first domain and not force it for the other one
This is my current .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Upvotes: 0
Views: 251
Reputation: 1998
Try something like this? It should check if the domain is equal to leadersuae.ae
and if its not, force HTTPS.
# Check if domain is AE OR NET
<If "%{HTTP_HOST} != 'leadersuae\.ae'">
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</If>
For this to work, please make sure you are using apache 2.4+.
Upvotes: 1