multi account site - htaccess question
Hey there, i am trying to make a little app that will serve multiple accounts, each one with it's user, etc.
so basically i got:
RewriteEngine on
RewriteBase /
RewriteRule ^$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/(.*)/(.*)$ index.php?account=$1&task=$2&id=$3
this works fine for http://sd.domain.com/a开发者_如何学Pythonccountname/index/
but not for: http://sd.domain.com/accountname, is throwing a 404.
so i think i need to just use the variables only when there are present, so i can make something like:
http://sd.domain.com/accountname -- default index controller --
http://sd.domain.com/accountname/index
http://sd.domain.com/accountname/campaigns/
http://sd.domain.com/accountname/view_campaign/5 -- campaign id should be here --
Thanks in advance, hope anyone can help.
Try this.
RewriteRule ^([^/]+)/?([^/]*)/?([^/]*)$ index.php?account=$1&task=$2&id=$3
精彩评论