mod_rewrite 模擬 mod_userdir - Linux
By Daniel
at 2010-02-25T15:01
at 2010-02-25T15:01
Table of Contents
因為一些特殊需求,我的使用者網頁會放在 /home/user/home/user/www 下
兩次 /home/user 不是 typo,是真的兩層 /home/user XD
因為這種特殊目錄結構導致 apache 的 mod_userdir 沒法直接去讀使用者的網頁
(我用過 wildcard * 去設定,但 * 只能用一次,第二個 * 會抓不到)
於是關掉 mod_userdir 想用 mod_rewrite 去實現 mod_userdir 的功能
RewriteEngine On
RewriteRule ^~([a-z0-9]+)(.*) /home/$1/home/$1/www$2
可是實際運作時發現,apache 把 /home/$1/home/$1/www$2 加到
DocumentRoot 後面變成去讀 http://FQDN/home/user/home/user/www/
但我原意是想他去讀實體目錄 /home/user/home/user/www
請問 mod_rewrite 有辦法做到我要的效果嗎?
--
兩次 /home/user 不是 typo,是真的兩層 /home/user XD
因為這種特殊目錄結構導致 apache 的 mod_userdir 沒法直接去讀使用者的網頁
(我用過 wildcard * 去設定,但 * 只能用一次,第二個 * 會抓不到)
於是關掉 mod_userdir 想用 mod_rewrite 去實現 mod_userdir 的功能
RewriteEngine On
RewriteRule ^~([a-z0-9]+)(.*) /home/$1/home/$1/www$2
可是實際運作時發現,apache 把 /home/$1/home/$1/www$2 加到
DocumentRoot 後面變成去讀 http://FQDN/home/user/home/user/www/
但我原意是想他去讀實體目錄 /home/user/home/user/www
請問 mod_rewrite 有辦法做到我要的效果嗎?
--
Tags:
Linux
All Comments
By Edwina
at 2010-02-26T20:58
at 2010-02-26T20:58
By Daph Bay
at 2010-02-27T02:13
at 2010-02-27T02:13
By Carol
at 2010-02-27T04:39
at 2010-02-27T04:39
By Jake
at 2010-03-02T07:15
at 2010-03-02T07:15
By Lauren
at 2010-03-02T15:53
at 2010-03-02T15:53
By Irma
at 2010-03-05T12:19
at 2010-03-05T12:19
By George
at 2010-03-06T01:50
at 2010-03-06T01:50
By Donna
at 2010-03-09T22:07
at 2010-03-09T22:07
By Callum
at 2010-03-13T21:57
at 2010-03-13T21:57
By David
at 2010-03-18T10:59
at 2010-03-18T10:59
By Isla
at 2010-03-20T16:20
at 2010-03-20T16:20
Related Posts
ubuntu 的 ifcfg-* 都放在哪?
By Gary
at 2010-02-25T09:22
at 2010-02-25T09:22
ubuntu 9.10 open with archive mounter
By Christine
at 2010-02-25T01:57
at 2010-02-25T01:57
有關於一篇linux的入門介紹...
By Ursula
at 2010-02-25T01:32
at 2010-02-25T01:32
ibus 跟 Flash 相衝問題
By Doris
at 2010-02-25T01:19
at 2010-02-25T01:19
有關下載http上的資料
By Rosalind
at 2010-02-25T01:04
at 2010-02-25T01:04