Answers.Body: <p>You need to use <code>/actions</code> (or whatever your Trigger word is) to access Controller actions.</p>
  
  <p>Documentation: <a href="http://buildwithcraft.com/docs/config-settings#actionTrigger" rel="nofollow">http://buildwithcraft.com/docs/config-settings#actionTrigger</a></p>
  
  <p><strong>EDIT:</strong> I realize I wasn't clear enough; this variable defaults to <code>/actions</code>. Unless you've set it to something else in your Config, add the <code>/actions</code> to your URL to access the Controller action.</p>
  
  <p>So, your URL would be this: <code>http://domain.craft.dev/actions/PluginHandle/Duh/foo</code></p>
  
  <p>Note that <strong>capitalization matters.</strong></p>
  
  <p>It's also important to make sure that if you plan on making calls to this URL from outside Craft, you'll need to make sure that you're allowing anonymous access by setting that variable at the top of your controller:</p>
  
  <p><code>protected $allowAnonymous = true;</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-20T17:14:35.973Z
Answers.Text: My Config does not have any such entry.
Answers.UserDisplayName: Volatil3
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T06:57:13.430Z
Answers.Text: the default action trigger is 'actions' so there doesn't need to be anything in your config. just try hitting `/actions/db/dauh/foo`
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-20T17:00:04.977Z
Answers.LastActivityDate: 2015-10-21T20:53:56.267Z
Answers.LastEditDate: 2015-10-21T20:53:56.267Z
Answers.UserDisplayName: Taylor Daughtry
Body: <p>So I am working on it first time. I created a Controller <code>DB_DuhController</code> having a method <code>actionFoo()</code></p>
  
  <p>I am then calling it as <code>http://domain.craft.dev/admin/DB/duh/Foo</code> but it's giving <code>404</code> all the time. What is wrong being done by me?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-20T09:39:02.090Z
Comments.Text: Should it be `/admin/db/duh/foo` with lower case db? I think the plugin name is lowercase for first letter: http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing same with action name `foo` not `Foo`. Also assume you have a CP route in place for the `/admin` request.
Comments.UserDisplayName: Luke Holder
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-20T10:25:56.780Z
Comments.Text: `/admin` is working but not after that.
Comments.UserDisplayName: Volatil3
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-20T10:27:22.643Z
Comments.Text: post your cp route.
Comments.UserDisplayName: Luke Holder
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-20T10:27:27.253Z
Comments.Text: My `hookRegisterCpRoutes` method is empty. Do I need to define routes first?
Comments.UserDisplayName: Volatil3
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-20T10:29:12.710Z
Comments.Text: Yes unless you are accessing it with the /actions url
Comments.UserDisplayName: Luke Holder
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-20T10:32:44.650Z
Comments.Text: you mean `http://domain.craft.dev/admin/DB/duh/actions/Foo`?
Comments.UserDisplayName: Volatil3
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-20T10:54:12.980Z
Comments.Text: I did this: `DB/duh/list' => array('action' => 'db/_list')` and it says: `Unable to resolve the request "duh/list".
Comments.UserDisplayName: Volatil3
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-20T11:17:53.387Z
Comments.Text: @LukeHolder there?
Comments.UserDisplayName: Volatil3
Tags: <plugin-development><routing>
Title: Craft Controller gives 404 error
ThreadText: # Craft Controller gives 404 error
  
  (Asked by: username_0 on 2015-10-20)
  
  So I am working on it first time. I created a Controller `DB_DuhController` having a method `actionFoo()`
  
  I am then calling it as `http://domain.craft.dev/admin/DB/duh/Foo` but it's giving `404` all the time. What is wrong being done by me?
  
  **Tags:** plugin-development, routing
  
  > **Comments:**
  > **username_1**: Should it be `/admin/db/duh/foo` with lower case db? I think the plugin name is lowercase for first letter: http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing same with action name `foo` not `Foo`. Also assume you have a CP route in place for the `/admin` request.  
  > **username_0**: `/admin` is working but not after that.  
  > **username_1**: post your cp route.  
  > **username_0**: My `hookRegisterCpRoutes` method is empty. Do I need to define routes first?  
  > **username_1**: Yes unless you are accessing it with the /actions url  
  > **username_0**: you mean `http://domain.craft.dev/admin/DB/duh/actions/Foo`?  
  > **username_0**: I did this: `DB/duh/list' => array('action' => 'db/_list')` and it says: `Unable to resolve the request "duh/list".  
  > **username_0**: @username_1 there?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-10-20. Score: 2
  
  You need to use `/actions` (or whatever your Trigger word is) to access Controller actions.
  
  Documentation: <http://buildwithcraft.com/docs/config-settings#actionTrigger>
  
  **EDIT:** I realize I wasn't clear enough; this variable defaults to `/actions`. Unless you've set it to something else in your Config, add the `/actions` to your URL to access the Controller action.
  
  So, your URL would be this: `http://domain.craft.dev/actions/PluginHandle/Duh/foo`
  
  Note that **capitalization matters.**
  
  It's also important to make sure that if you plan on making calls to this URL from outside Craft, you'll need to make sure that you're allowing anonymous access by setting that variable at the top of your controller:
  
  `protected $allowAnonymous = true;`
  
  > **Comments:**
  > **username_0**: My Config does not have any such entry.  
  > **username_1**: the default action trigger is 'actions' so there doesn't need to be anything in your config. just try hitting `/actions/db/dauh/foo`  
  
  ---
  
  