Answers.Body: <p><code>actionUrl()</code> and <a href="http://buildwithcraft.com/classreference/helpers/UrlHelper#getActionUrl-detail" rel="noreferrer"><code>UrlHelper::getActionUrl()</code></a> always force the script name to show up despite the <a href="http://buildwithcraft.com/docs/config-settings#omitScriptNameInUrls" rel="noreferrer">omitScriptNameInUrls</a> config setting for two reasons:</p>
  
  <ol>
  <li>Action URLs are generally not actually visible to end users, so there’s no point in hiding “index.php” from them (computers don’t care about aesthetics).</li>
  <li>They are often used for POST requests, and your index.php redirect in .htaccess will drop any POST data associated with the request.</li>
  </ol>
  
  <p>That said, if you <em>really</em> want to create an action URL that omits “index.php”, you can do this:</p>
  
  <pre><code>{{ url(craft.config.actionTrigger ~ '/your/action/path') }}
  </code></pre>
  
  <p>(I don’t think your use case is valid though. Just commented on it.)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-21T17:35:33.130Z
Answers.LastActivityDate: 2014-11-21T17:35:33.130Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I have an controller action in my custom plugin that processes Paypal IPN requests. How it works is that you provide a URL for Paypal to send it's notification requests to and then process them and send an acknowledgement.</p>
  
  <p>I'm using <code>{{ actionUrl('plugin/action') }}</code> in my template to generate the URL that I provide to Paypal, but no matter what I try I can't get it to omit the script name from the URL. <code>$omitScriptNameInUrls</code> set to true in config has no effect.</p>
  
  <p>This is necessary, because I need to do some checking in my config file based on the URL to disable CSRF protection for only the Paypal IPN controller action, as described in this question: <a href="https://craftcms.stackexchange.com/questions/4553/whats-the-best-way-to-skip-csrf-for-plugin-controllers/4554">What&#39;s the best way to skip CSRF for plugin controllers?</a></p>
  
Tags: <plugin-development><config><controller><csrf>
Title: How can I ensure using actionUrl in my template does not show script name in the generated URL?
ThreadText: # How can I ensure using actionUrl in my template does not show script name in the generated URL?
  
  (Asked by: username_0 on 2014-11-21)
  
  I have an controller action in my custom plugin that processes Paypal IPN requests. How it works is that you provide a URL for Paypal to send it's notification requests to and then process them and send an acknowledgement.
  
  I'm using `{{ actionUrl('plugin/action') }}` in my template to generate the URL that I provide to Paypal, but no matter what I try I can't get it to omit the script name from the URL. `$omitScriptNameInUrls` set to true in config has no effect.
  
  This is necessary, because I need to do some checking in my config file based on the URL to disable CSRF protection for only the Paypal IPN controller action, as described in this question: [What's the best way to skip CSRF for plugin controllers?](https://craftcms.stackexchange.com/questions/4553/whats-the-best-way-to-skip-csrf-for-plugin-controllers/4554)
  
  **Tags:** plugin-development, config, controller, csrf
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-11-21. Score: 5 | Accepted answer
  
  `actionUrl()` and [`UrlHelper::getActionUrl()`](http://buildwithcraft.com/classreference/helpers/UrlHelper#getActionUrl-detail) always force the script name to show up despite the [omitScriptNameInUrls](http://buildwithcraft.com/docs/config-settings#omitScriptNameInUrls) config setting for two reasons:
  
  1. Action URLs are generally not actually visible to end users, so there’s no point in hiding “index.php” from them (computers don’t care about aesthetics).
  2. They are often used for POST requests, and your index.php redirect in .htaccess will drop any POST data associated with the request.
  
  That said, if you *really* want to create an action URL that omits “index.php”, you can do this:
  
  ```
  {{ url(craft.config.actionTrigger ~ '/your/action/path') }}
  
  ```
  
  (I don’t think your use case is valid though. Just commented on it.)
  
  
  ---
  
  