สิ่งที่ผมต้องการคือ
Redirect 301 | domain จาก shop.web1.com
ไปที่ shop.web2.com
โดยให้ redirect แค่ใน subdomain shop เท่านั้น และอยากให้ path ต่อท้ายนั้น redirect ไปด้วย เช่น
shop.web1.com/product/name0001 --> shop.web2.com/product/name0001
ทีนี่ ....
subdomain แรก ( shop.web1.com )
ไม่มี ssl ครับต้องเป็น http เท่านั้น
ผมเลยลองแก้ htaccess แล้วเป็น
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} shop.web1.com$ [NC]
RewriteRule ^/?shop/(.*)$ https://shop.web2.com/$1 [R=301,L]
RewriteCond %{HTTPS} Off
RewriteRule ^ https://shop.web2.com%{REQUEST_URI} [R=301,L]
ผลคือ เวลาเข้า shop.web1.com มันจะขึ้นเตือนว่า
Your connection is not private
Attackers might be trying to steal your information from shop.web1.com
(for example, passwords, messages, or credit cards). Learn more
NET::ERR_CERT_COMMON_NAME_INVALID
ผมพิมพ์อะไรผิดไปรึเปล่าครับ
web1.com -> web2.com (server-side) = phishing
ลองใช้ Domain Forwarding ใน Web Control Center (Direct Admin) น่าจะช่วยได้ครับ
ปัญหาน่าจะเป็นเพราะ
shop.web1.com
ssl/tls certificate invalid ครับ ต่อให้ server return redirect แบบไหน (่ผ่านทางการแก้ htaccess) Browser ก็ไม่ทำตามครับ เพราะ Brower ถือว่า response นี้ไม่ปลอดภัยทางแก้น่าจะเป็นว่าทำ SSL บน shop.web1.com ให้ใช้งานได้ครับ