Yii Framework Forum: 可不可以限制某个Controller只能处理来自某个域名的访问呢?急啊! - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

可不可以限制某个Controller只能处理来自某个域名的访问呢?急啊! 在多个子域名绑定的同一目录会很有用 Rate Topic: -----

#1 User is offline   yiiz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 06-May 10

Posted 30 August 2010 - 09:15 PM

可不可以限制某个Controller只能处理来自某个域名的访问呢?在多个子域名绑定的同一目录时会很有用。Yii目前有这方面的支持吗?

比如我现在有个AController和BController,我想分别绑定a.domain.com和b.domain.com,当访问a/action和使用a.domain.com而同理b/action一样,这通过配置Url规则是可以实现的。但是b/action却同样可以通过a.domain.com/index.php?r=b/action访问到,这不是我希望的,这希望这时可以抛出个400,不知道有没有办法实现。
0

#2 User is offline   EricPan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 31-August 10

Posted 31 August 2010 - 04:44 AM

可以的呀,可以再controller的filter里面,重载filterAccess,在里面去判断域名就可以
0

#3 User is offline   yiiz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 06-May 10

Posted 31 August 2010 - 06:44 AM

View PostEricPan, on 31 August 2010 - 04:44 AM, said:

可以的呀,可以再controller的filter里面,重载filterAccess,在里面去判断域名就可以

嗯,我试试 :rolleyes:
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users