作者: peterchu1 時間: 2023-1-31 09:51 標題: URL redirect
我原本有個 website ( www.abc.def.domain.com ) , 剛做左個新 website ( www.def.domain.com ) , 想將所有指去舊 website 既都 redirect 去新 website , 請問係咪要係 DNS 可以做到 ? 大概係點做 ?
Thanks
作者: TH30 時間: 2023-1-31 10:41
小學程度學寫html類似咁
- <html>
- <head>
- <title>HTML Redirect</title>
- <meta http-equiv="refresh" content="3; url = www.def.domain.com " />
- </head>
- <body>
- <h1>WELCOME TO www.abc.def.domain.com</h1>
- <p>you'll be redirected to www.def.domain.com in 5 seconds.</p>
- </body>
- </html>
作者: peterchu1 時間: 2023-1-31 14:38
如果咁樣 , 我咪要保留舊 website ? 我係唔想保留舊 website
作者: tunster 時間: 2023-1-31 14:51
https://freedirector.io
作者: BtCeTh 時間: 2023-1-31 17:03
可以用DNS CNAME
作者: freefdhk 時間: 2023-1-31 19:52
當 兩組 c or a record 指去同一ip後.
apache bind 左呢2個domain 去同一個.
直接 用.htaccess 去 rewrite 個 domain 由 a 去b.
https://wpscholar.com/blog/redir ... omain-via-htaccess/
有點類似 http -> https 的 寫法。
作者: javacomhk 時間: 2023-2-1 11:14
如果係 nginx 嘅話,參考
https://ubiq.co/tech-blog/redirect-url-nginx/
作者: peterchu1 時間: 2023-2-3 11:17
以上方法都係要保留原有 website , 咁樣會一直用住個 host 同 IP .
但其實可以在 DNS server 上要改設定做 re-direct 嗎 ?
作者: tunster 時間: 2023-2-3 12:06
以上方法都係要保留原有 website , 咁樣會一直用住個 host 同 IP .
但其實可以在 DNS server 上要改設定做 ...
peterchu1 發表於 2023-2-3 11:17
咪俾佐你囉, 又唔睇
作者: peterchu1 時間: 2023-2-3 12:34
redirect 去果個一定係 IP address ? 唔可以指去 URL ?
thanks
作者: javacomhk 時間: 2023-2-3 12:41
Difference Between A and CNAME
An A Record maps a hostname to one or more IP addresses, while the CNAME record maps a hostname to another hostname.
作者: tunster 時間: 2023-2-3 12:54
你自己入去睇下先啦, 唔睇就問
作者: justiceice 時間: 2023-2-3 16:03
以上方法都係要保留原有 website , 咁樣會一直用住個 host 同 IP .
但其實可以在 DNS server 上要改設定做 ...
peterchu1 發表於 2023-2-3 11:17
一個 IP 可以無限個 hostname,網頁嘅話你個 HTTP server 識應對就得,上面都有講過吓 Apache 或者 nginx 嘅做法
DNS 落 CNAME record 嘅話,可以指舊嘅 subdomain (例如你舉例嘅 www.abc.def.domain.com )參照返邊個 domain (例如你舉例嘅 www.def.domain.com )
不過如果用 CNAME 做嘅話,會導致新舊 domain 都去到同樣網站,如果你想網址欄會自動 redirect 埋去新 domain,建議都係 HTTP server 層面做 redirect
如果個 HTTP server 不受你控制嘅話,最平嘅做法就係用 Netlify,舊嘅 subdomain 指去 Netlify,然後喺 Netlify 度做 redirect
作者: max918 時間: 2023-2-7 00:48
如果要考慮SEO
應該係要回覆HTTP 301 指去新網址
作者: kong275327134 時間: 2023-2-16 10:08
之前用namecheap 係可以做到 但唔知係唔係間間都可以
https://www.namecheap.com/suppor ... a-url-for-a-domain/

