Google Custom Search 404 not found

Hello all,
I’m trying to integrate GCS to my modx site. the layout is two page results, where search box is on any page and the results are on /searchresults.html
the issue is that Google adds ‘q’ to the query and modx shows 404 not found. I read very old results of same issue where the answer was to modify the search box result to have upper case Q instead of lower case.

however I think since then Google has changed the way the search is done and now I can’t seem to find where I can change the Q parameters.

MODX uses the q parameter for friendly URLs. If you can’t change it for GCS (I’m not familiar with how that works), you can change MODX.

In the system settings, change request_param_alias to something different. Perhaps modxq or fq or something else you wont be using.

Next, in your .htaccess file, change:

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


RewriteRule ^(.*)$ index.php?modxq=$1 [L,QSA]

Basically, replacing q / modxq with whatever you changed the request_param_alias setting to.

If you use nginx, make the same change but then in your server configuration/location block.

Worked a charm. Thank you very much Mark!

1 Like