看板 PHP 關於我們 聯絡資訊
原本的網址是 domain.com.tw 要轉向到 domain.tw 目前的寫法如下 RewriteCond %{HTTP_HOST} ^domain\.com\.tw$ [OR] RewriteCond %{HTTP_HOST} ^www\.domain\.com\.tw$ RewriteRule ^/?$ "http\:\/\/domain\.tw\/" [R=301,L] 但是測試過後發現 domain.com.tw/about.php 仍然會開啟舊網頁 不會被導向到 domain.tw 不知道有沒有前輩可以指點一下要怎麼修改? m(_ _)m 拜 google 大神所賜~目前找到適用的方案~ 在 htaccess 加入下面規則 只要開啟 domain.com.tw 就會被丟到 domain.tw RewriteRule ^(.*)$ http://www.domain.tw/ [R=301,L] 如果要連後面的檔名也一起帶過去的話後面可以加上 $1 RewriteRule ^(.*)$ http://www.domain.tw/$1 [R=301,L] 這樣開啟 domain.com.tw/about.php 就會被導向 domain.tw/about.php -- _ ◣██◣█◢█◢ ψ sanbis ◢████◣ ◥██◤ ◥██◤ ◢ ◢█◤◥◤ ─ ─ ◤ ◥ ██ = =ˇ﹀﹀ˇ ◣◥██ ██◤◢ || ◣◆ ┐ ┌ ◥██ ██◤ < 喂!那是我家耶!? \ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.125.62.244 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1563866680.A.B0F.html ※ 編輯: sanbis (59.125.62.244 臺灣), 07/23/2019 15:38:22
BZnoo: 自解後分享經驗推推 07/23 23:27
newversion: pcre 07/28 01:05