2017-07-16 61 views
0

嗨HTTPS WWW此代碼劑量無法正常工作重定向多個域到一個域具有或不具有使用htaccess的

RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-l 

################## Force HTTPS & WWW ################ 
RewriteCond %{HTTPS} off 
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
################# Contact ############################ 
RewriteCond %{HTTP_HOST} ^contact-services.net [OR] 
RewriteCond %{HTTP_HOST} ^contactmadinaty.com [OR] 
RewriteCond %{HTTP_HOST} ^contactmadinaty.net [OR] 
RewriteCond %{HTTP_HOST} ^madinaty.city [OR] 
RewriteCond %{HTTP_HOST} ^madinatyrealestate.com [OR] 
RewriteCond %{HTTP_HOST} ^madinatyrealestate.net [OR] 
RewriteCond %{HTTP_HOST} ^realestate-madinaty.com [OR] 
RewriteCond %{HTTP_HOST} ^realestatemadinaty.com [OR] 
RewriteCond %{HTTP_HOST} ^realestatemadinaty.net 
RewriteRule ^(.*)$ https://www.contact-madinaty.com/$1 [R=permanent,L] 
###################################################### 

上述代碼努力非www到www重定向以https但不是重定向域

回答

0

是否有如下的幫助?這對我來說

RewriteEngine On 
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 
+0

這一點,如果只有一個域,我需要多個域 – Muhamad

+0

這會將所有其他域重定向到www.example.com(一切不是www.example.com)工作的罰款。它適用於多個域名 – mousi

相關問題