I 3 Urls haben und ssl ZertifizierungRemove "WWW" von "{HTTP_HOST}" in .htaccess Regeln
1) www.example.com
2) myexample.com
3) haben otherexample.com
Ich muss alle oben genannten drei URLs zu https Secure URL z : Wenn Benutzer eine beliebige URL öffnen, sollte sie zu https URL umleiten.
=> when user open www.example.com OR example.com >>> it should redirect to https://www.example.com
=> when user open www.myexample.com OR myexample.com OR https://www.myexample.com >>> it should redirect to https://myexample.com
=> when user open www.otherexample.com OR otherexample.com OR https://www.otherexample.com >>> it should redirect to https://otherexample.com
Anmerkung: Ich ssl certificat haben für www.example.com, myexample.com (non-www), otherexample.com (non-www)
Ich brauche Hilfe, mein Problem zu lösen. auch ich möchte Regeln dynamisch so in Zukunft setzen, wenn ich mehr URL (s) habe, so wird .htaccess Datei nicht bearbeiten. (Wenn möglich, "www" von {HTTP_HOST} zu entfernen, setze Regeln unten, so würde es gut für mich sein)
Ich habe coupule Regeln in htaccess gesetzt, aber es funktioniert nicht für mich.
RewriteCond %{HTTP_HOST} !^www\. [OR]
RewriteCond %{HTTP_HOST} ^www\.
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]
#rule for myexample.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com [nocase]
RewriteRule ^(.*) https://example.com/$1 [last,redirect=301]
#rule for otherexample.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.otherexample.com [nocase]
RewriteRule ^(.*) https://otherexample.com/$1 [last,redirect=301]
Ja ich diese URL bereits gesetzt, aber für andere URL wird es nicht funktionieren. Wenn der Benutzer www.myexample.com öffnet, wird er auf https://www.myexample.com umgeleitet, aber das ssl-Zertifikat gibt eine Ausnahme. Das sind die Hauptprobleme, die ich lösen möchte. :) –
Dieser Link wird Ihnen helfen, dynamische Domain oder Subdomain.http: //stackoverflow.com/questions/19427256/htaccess-automatisch-detect-domain-name –