开发者

htaccess, Redirect all requests to https://www [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic开发者_运维技巧 for Stack Overflow.

Closed 11 years ago.

Improve this question

Using .htaccess, I need to redirect all requests from

http://www.domain,
http://domain,
https://domain

to;

https://www.domain.com

How would I do this? I don't have any subdomains.


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] 
RewriteCond %{http_host} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]    

That will direct all HTTP requests to https://www.example.com as well as redirect https://example.com to https://www.example.com.


Try this one...

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$ [OR]
RewriteCond %{HTTPS_HOST} ^domain.com$
RewriteRule ^(.*)$ "https\:\/\/www\.domain\.com\/$1" [R=301,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜