<p>I think we need more information to be able to consider possible solutions. I personally wouldn't do anything in Craft, rewriting this URL before it hits the application would be cleaner. I don't know if it's possible to configure the 'action' parameter name in Craft so let's assume not.</p>
<p>Are the referring URLs always the same? In other words, is the visitor always returned to the same URL on your site (which contains &amp;action=something)? If so, a fairly simple Apache/nginx rewrite URL could be written to remove the parameter from the request.</p>
<p>If not, it may still be achievable with a rewrite rule if you're willing to trust the HTTP_REFERER variable.</p>

CC BY-SA 4.0
2021-04-20T13:43:39.860Z
Just to confirm, the `action` parameter is indeed hardcoded, so it's impossible to change it. See [craft\web\Request](https://github.com/craftcms/cms/blob/3.6.13/src/web/Request.php#L1612-L1616)
MoritzLost
CC BY-SA 4.0
2021-04-21T09:16:37.190Z
We've gone for a URL rewrite using Apache, it seems to work so far in testing and you're right in it should be a cleaner way. My 'hack' was a last resort, if it were even possible.
Jaytrix
CC BY-SA 4.0
2021-04-20T12:03:47.023Z
2021-04-20T12:03:47.023Z
Wallace
<p>Is there a way to ignore part of a querystring if it contains the parameter &quot;action&quot;?</p>
<p>We have a 3rd party site which returns to one of our sites and they append &quot;&amp;action=something&quot; to the querystring. The 3rd party site are not able to remove this parameter, so when the user gets returned to our site they're greeted with a 404 page - the Craft docs suggest 'action' is used to determin an action controller to use, which in this case there is not one set.</p>
<p>My 'hack' of an idea would be to detect the parameter in a template, remove that parameter, then go to the url without the 'action' parameter set. This would add more page requests, which would be annoying for a user I can imagine.</p>

<params><querystring><action>
Ignore 'action' querystring parameter
# Ignore 'action' querystring parameter

(Asked by: username_0 on 2021-04-20)

Is there a way to ignore part of a querystring if it contains the parameter "action"?

We have a 3rd party site which returns to one of our sites and they append "&action=something" to the querystring. The 3rd party site are not able to remove this parameter, so when the user gets returned to our site they're greeted with a 404 page - the Craft docs suggest 'action' is used to determin an action controller to use, which in this case there is not one set.

My 'hack' of an idea would be to detect the parameter in a template, remove that parameter, then go to the url without the 'action' parameter set. This would add more page requests, which would be annoying for a user I can imagine.

**Tags:** params, querystring, action


---

## 1 answers

### Answer by username_1 on 2021-04-20. Score: 2 | Accepted answer

I think we need more information to be able to consider possible solutions. I personally wouldn't do anything in Craft, rewriting this URL before it hits the application would be cleaner. I don't know if it's possible to configure the 'action' parameter name in Craft so let's assume not.

Are the referring URLs always the same? In other words, is the visitor always returned to the same URL on your site (which contains &action=something)? If so, a fairly simple Apache/nginx rewrite URL could be written to remove the parameter from the request.

If not, it may still be achievable with a rewrite rule if you're willing to trust the HTTP\_REFERER variable.

> **Comments:**
> **username_2**: Just to confirm, the `action` parameter is indeed hardcoded, so it's impossible to change it. See [craft\web\Request](https://github.com/craftcms/cms/blob/3.6.13/src/web/Request.php#L1612-L1616)  
> **username_0**: We've gone for a URL rewrite using Apache, it seems to work so far in testing and you're right in it should be a cleaner way. My 'hack' was a last resort, if it were even possible.  

---

