Tags:

สิ่งที่ผมต้องการคือ

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

ผมพิมพ์อะไรผิดไปรึเปล่าครับ

Get latest news from Blognone
By: big50000
AndroidSUSEUbuntu
on 26 October 2021 - 20:43 #1229255
big50000's picture

web1.com -> web2.com (server-side) = phishing

By: 21Aki
ContributorAndroidWindows
on 31 October 2021 - 19:03 #1229951
21Aki's picture

ลองใช้ Domain Forwarding ใน Web Control Center (Direct Admin) น่าจะช่วยได้ครับ

By: ZiiT
ContributorAndroidWindows
on 1 November 2021 - 09:18 #1229990

ปัญหาน่าจะเป็นเพราะ shop.web1.com ssl/tls certificate invalid ครับ ต่อให้ server return redirect แบบไหน (่ผ่านทางการแก้ htaccess) Browser ก็ไม่ทำตามครับ เพราะ Brower ถือว่า response นี้ไม่ปลอดภัย

ทางแก้น่าจะเป็นว่าทำ SSL บน shop.web1.com ให้ใช้งานได้ครับ