[問題] 一個有關 apache mod_rewrite 的問題

看板Web_Design作者 (ChrisLiu)時間17年前 (2008/11/24 11:02), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我想依照這頁的範例建立一個一樣的 rewrite rule http://blog.ixpub.net/html/18/9727518-68873.html 虛擬用戶主機 描述: 如果需要為用戶username支持一個www.username.host.com的主頁,但不在此 機器上建虛擬主機,而是僅用在此機器上增加一個DNS A記錄的方法實現。 解決方案: 僅能對包含"Host: "頭的HTTP/1.1請求實現。可以使用以下規則集內部地將 http://www.username.host.com/anypath 重寫為 /home/username/anypath RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.[^.]+\.host\.com$ RewriteRule ^(.+) %{HTTP_HOST}$1 [C] RewriteRule ^www\.([^.]+)\.host\.com(.*) /home/$1$2 不過依照他的範例設定到 httpd.conf 之後, 如果我瀏覽 www.test.host.com 的網頁 卻會出現 You don't have permission to access /home/testhome/test/testhome (中間很多一樣的重複) /home/testindex.php/testindex.php .... (一樣很多的重複) /testhome/testindex.php/testindex.php on this server. 我有設定 RewriteLog 且 RewriteLogLevel 也設定了 3~9 不過 log 檔中並沒有任何資料 ~"~? 因為 google 到的資料和我手邊這本書寫得一樣… 不知道是這樣的寫法有問題還是我 apache 設定有問題呢… 感謝回答~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.145.202.66
文章代碼(AID): #19AXbBNn (Web_Design)