2016-04-25 57 views
-1

首先,我想通过.htaccess将我的http域转换为https域,并将非www转换为www域。如何将http转换为https

  1. http://quickassignmenthelp.co.uk/https://quickassignmenthelp.co.uk/

  2. https://quickassignmenthelp.co.uk/https://www.quickassignmenthelp.co.uk/

我编码:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^quickassignmenthelp\.co.uk$ [NC] 
RewriteRule ^(.*)$ http://www.quickassignmenthelp.co.uk/$1 [R=301,L] 

# BEGIN EXPIRES 
<IfModule mod_expires.c> 
    ExpiresActive On 
    ExpiresDefault "access plus 10 days" 
    ExpiresByType text/css "access plus 1 week" 
    ExpiresByType text/plain "access plus 1 month" 
    ExpiresByType image/gif "access plus 1 month" 
    ExpiresByType image/png "access plus 1 month" 
    ExpiresByType image/jpeg "access plus 1 month" 
    ExpiresByType application/x-javascript "access plus 1 month" 
    ExpiresByType application/javascript "access plus 1 week" 
    ExpiresByType application/x-icon "access plus 1 year" 
</IfModule> 
# END EXPIRES 
+0

什么是不工作? – anubhava

回答

1

试试这个:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^quickassignmenthelp\.co.uk$ [NC] 
RewriteRule^https://www.quickassignmenthelp.co.uk%{REQUEST_URI} [R=301,L] 

RewriteCond %{HTTPS} off [NC] 
RewriteRule^https://www.quickassignmenthelp.co.uk%{REQUEST_URI} [R=301,L] 

并从您自己的代码的开头删除3行。

+0

它将重定向到https,但错误应对 –

+0

请检查域名 https://www.quickassignmenthelp.co.uk/ –