2017-07-16 56 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

相关问题