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?

1 Answer 1


actionUrl() and UrlHelper::getActionUrl() always force the script name to show up despite the 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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.