[問題] (不再鬼打牆) mod_rewrite 的問題…
---------不好意思,先前程式出了一點問題,以下為修正後的版本0rz----------
嗯嗯~事情是如此的…
假設今天我有很多個url是指到同一個ip的
例如
dns1.grassboy2.com
dns2.grassboy2.com
dns3.grassboy2.com
:
:
然後我的主機會根據不同的url會去作mod_rewrite
我希望只要host是dns1.grassboy.com的
全都導到網站根目錄下的dns1資料夾
也就是說… http://dns1.grassboy2.com/dir1/index.php
會導到 http://dns1.grassboy2.com/dns1/dir1/index.php
我在網路上有查了一下…
應該會在.htaccess下加上下面幾行:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^dns1.grassboy2.com$ [NC]
RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteRule ^(.*)$ dns1/$1 [NC]
現在問題來了…
如果我網站根目錄下已經有一個dir1資料夾…
http://dns1.grassboy2.com/dir1/index.php
似乎是會優先指到 /dir1/index.php 而非 /dns1/dir1/index.php
請問有辦法藉由純修改.htaccess的方式去避免這狀況嗎?
也就是 dns1.grassboy2.com 無條件從 / 轉到 /dns1/ 下
先感謝大家的回答了 m(_ _)m
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.87.174
→
12/10 12:02, , 1F
12/10 12:02, 1F
→
12/10 12:02, , 2F
12/10 12:02, 2F
→
12/10 12:03, , 3F
12/10 12:03, 3F
→
12/10 12:09, , 4F
12/10 12:09, 4F
→
12/10 13:50, , 5F
12/10 13:50, 5F
→
12/10 20:17, , 6F
12/10 20:17, 6F
推
12/10 20:29, , 7F
12/10 20:29, 7F
→
12/10 20:30, , 8F
12/10 20:30, 8F
→
12/10 20:30, , 9F
12/10 20:30, 9F
推
12/11 22:30, , 10F
12/11 22:30, 10F
※ 編輯: grassboy2 來自: 140.113.87.174 (12/12 08:54)
※ 編輯: grassboy2 來自: 140.113.87.174 (12/12 08:55)
推
12/14 16:27, , 11F
12/14 16:27, 11F