2011-05-20 92 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