Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: .htaccess - Force www. on http and https |
|
Author |
|
ReeceN
Joined: 19 Sep 2015 Posts: 1 Location: Newcastle upon Tyne
|
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Sun 20 Sep '15 11:15 Post subject: |
|
|
In a non-https vhost:
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !=""
RewriteRule ^/(.*) http://www\.domain\.com/$1 [L,R=301]
In a https vhost:
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !=""
RewriteRule ^/(.*) https://www\.domain\.com/$1 [L,R=301] |
|
Back to top |
|
|
|
|
|
|