2011-05-20 91 views
0

嘿,我試圖做一個小應用程序,將服務於多個賬戶,每一個與它的用戶等多帳戶網站 - htaccess的問題

所以基本上我得到:

RewriteEngine on 

RewriteBase/


RewriteRule ^$      index.php [L] 
RewriteCond %{REQUEST_FILENAME}  !-f 
RewriteCond %{REQUEST_FILENAME}  !-d 


RewriteRule (.*)/(.*)/(.*)$      index.php?account=$1&task=$2&id=$3 

這個工作得很好http://sd.domain.com/accountname/index/

但不適合:http://sd.domain.com/accountname,被扔了404

,所以我想我只是需要使用變量只WH恩不存在,所以我可以做類似:

http://sd.domain.com/accountname - 默認的索引器 -

http://sd.domain.com/accountname/index

http://sd.domain.com/accountname/campaigns/

http://sd.domain.com/accountname/view_campaign/5 - 系列ID應該在這裏 -

在此先感謝,希望任何人都可以提供幫助。

回答

2

試試這個。

RewriteRule ^([^/]+)/?([^/]*)/?([^/]*)$ index.php?account=$1&task=$2&id=$3 
+0

你好,那裏,感謝您的幫助,它仍然不能正常工作,我得到http://sd.d.com/act上的404而不是http://sd.d.com/act /在http://sd.d.com/act/task我得到罰款的任務,但在http://sd.d.com/act/task/id它失敗嚴重...... – 2011-05-20 10:12:57

+0

@Carlos Barbosa:更新。 – 2011-05-20 10:24:36

+0

哇.. !!只是哇.. !!謝啦..!!!我和我的曲棍球給你的兄弟帶來了很好的業力... !!! – 2011-05-20 10:26:00