我試圖編輯我的.htaccess文件來執行以下操作: 1)確定HTTP_HOST是否不是我自己的域,example.com 2)確定它是否它是otherdomain.com/admin/_anything_here_.htaccess對於HTTP_HOST後跟一個特定文件夾
/admin /是我正在尋找的特定文件夾,那麼我不在乎它後面會發生什麼(但我確實需要保留它)。所以基本上任何有/ admin /作爲第一個文件夾,而不是example.com應重寫otherdomain.com/admin/_anything_still_here_
這是我的理解是使用(。*)$將「存儲」_anything_here_部分並允許我以1美元的價格使用它。
我有這到目前爲止,但它不完全工作:
RewriteCond ^%{HTTP_HOST}+(/admin.*)$ !^([^.]+\.)*example\.com+(/admin.*)
RewriteRule (.*)$ rewrite/to/here$1/ [L]
我不明白'/ admin ...'會被重寫爲什麼。舉個例子。 for otherdomain.com/admin/_anything_here_' =>'otherdomain.com/admin/_anything_still_here_' – ThinkingMonkey 2012-02-14 19:45:04
對不起,有點不清楚。基本上,otherdomain.com/admin/_anything_here_應該重寫爲/ 1/1/1,其中1是_anything_here_。我在_anything_still_here_上的reasn只是爲了讓我明白,我不想在/ admin /之後加入這些東西。這有幫助嗎? – joshholat 2012-02-14 19:49:42
並不多。可以說URL是這個:'otherdomain.com/admin/site/old'。這個應該改寫成什麼? – ThinkingMonkey 2012-02-14 19:52:16