這裏是一個工作示例,希望對您有所幫助。
RewriteLog "/var/log/httpd/rewrite_log"
RewriteLogLevel 3
Alias /dummy.org /tmp/dummy.org
<Directory /tmp/dummy.org>
Options FollowSymLinks
RewriteEngine On
RewriteRule ^index.htm /en/somepage [R=301]
</Directory>
如果我使用 「http://127.0.0.1/dummy.org/index.htm」 它被改寫爲 「http://127.0.0.1/en/somepage」
(3) [perdir /tmp/dummy.org/] strip per-dir prefix: /tmp/dummy.org/index.htm -> index.htm
(3) [perdir /tmp/dummy.org/] applying pattern '^index.htm' to uri 'index.htm'
(2) [perdir /tmp/dummy.org/] rewrite 'index.htm' -> '/en/somepage'
(2) [perdir /tmp/dummy.org/] explicitly forcing redirect with http://127.0.0.1/en/somepage
(1) [perdir /tmp/dummy.org/] escaping http://127.0.0.1/en/somepage for redirect
(1) [perdir /tmp/dummy.org/] redirect to http://127.0.0.1/en/somepage [REDIRECT/301]
如果我使用 「http://127.0.0.1/dummy.org/someotherfolder/index.htm」 它不得到改寫
(3) [perdir /tmp/dummy.org/] add path info postfix: /tmp/dummy.org/someotherfolder -> /tmp/dummy.org/someotherfolder/index.htm
(3) [perdir /tmp/dummy.org/] strip per-dir prefix: /tmp/dummy.org/someotherfolder/index.htm -> someotherfolder/index.htm
(3) [perdir /tmp/dummy.org/] applying pattern '^index.htm' to uri 'someotherfolder/index.htm'
(1) [perdir /tmp/dummy.org/] pass through /tmp/dummy.org/someotherfolder
-Martin
+1,它的一個目錄中(共享主機上沒有虛擬的plesk l主機權限) – Sam 2011-03-18 19:28:05
@Sam你可以請張貼目錄部分(和別名,如果你使用)。它使分析起來更簡單。 – MNeimeier 2011-03-18 19:47:05
我重新說明了我的問題。這有幫助嗎?謝謝! – Sam 2011-03-18 19:51:57