All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server > รวมทุกอย่างเกี่ยวกับ Wordpress การติดตั้ง Plugin ปัญหา แนวทางแก้ไข

htaccess redirect http to https ใน wordpress ทำไงดี

(1/1)

golfreeze:
อันนี้เป็น default .htaccess ของ wordpress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

หลังจากทำ ssl เรียบร้อยให้เพิ่มเข้าไปดังนี้ครับ
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

เป็น

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

เท่านี้ก็เรียบร้อยละครับ  ;)
ทีมงาน Packetlove [dot] com

นำร่อง

[0] ดัชนีข้อความ

Go to full version