Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => command , shell script ,tool , crontab => Topic started by: golfreeze on กุมภาพันธ์ 23, 2016, 12:30:36 AM

Title: apache .htaccess redirect http to https
Post by: golfreeze on กุมภาพันธ์ 23, 2016, 12:30:36 AM
ต้องการให้ redirect subdomain
เมื่อเข้าจาก http://money.packetlove.com (http://money.packetlove.com)  เป็น https://money.packetlove.com (https://money.packetlove.com) ทุกครั้ง
#cd money
#vi .htaccess

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} (https://%{HTTP_HOST}%{REQUEST_URI}) [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^money\.
RewriteRule .* https://money.%{HTTP_HOST}%{REQUEST_URI} (https://money.%{HTTP_HOST}%{REQUEST_URI}) [L,R=301]