2016-10-05 13 views
1

würde Ich mag, dass alle diese Adressen:Redirect https: // www zu https: // Nicht-www

  1. http://www.example.com
  2. http://example.com(zur Zeit mit meiner .htaccess-Datei korrekt Umleitung) (zur Zeit richtig mit meiner .htaccess-Datei umleitet)
  3. https://www.example.com(diese Adresse umleiten nicht)

Umleitung zu https://example.com.

Mit der folgenden .htaccess-Datei, kann ich nur bekommen die 1. und 2. Adressen https://example.com umleiten.

Nur https://www.example.com wird Umleitung noch nicht zu https://example.com.

Hier ist meine .htacess Datei

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

# URL with www rewrite to https without www 
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC] 
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301] 

# URL without www rewrite to https 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC] 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 
+0

überprüfen [diese Antwort] (http://Stackoverflow.com/a/9945803/5019802) könnte es hilfreich sein. –

Antwort

1

Ihre Frage ist sicherlich ein Duplikat, aber ich kann nicht ein anständig man Punkt finden.

# URL with wrong domain to right one + https 
RewriteCond %{HTTP_HOST} !=example.com 
RewriteRule .* https://example.com/$0 [L,R=301] 

# URL with no https fix (domain already correct otherwise first rule would have matched) 
RewriteCond %{HTTPS} =off 
RewriteRule .* https://%{HTTP_HOST}/$0 [L,R=301] 
Verwandte Themen