Is there a way to detect if a URL contains a Super Search query?
I have a template that displays super search results, but analytics are also showing a bunch of non-existent URLs showing up in the same template group and I'd like to be able to detect if a URL contains a search query and if it doesn't, redirect to the 404 template.
Examples:
site.com/tours/made-up – bad
site.com/tours/search&keywords=island – good
I'm also having trouble with URLs that contain super search queries and gclid
querystrings and pagination. There's a stable of sites that are very similar. On one site, this works fine:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Redirect index.php Requests
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteCond %{THE_REQUEST} ^GET
RewriteRule ^index\.php(.+) $1 [R=301,L]
# Force the www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
# HTTPS Redirects
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.site.com/$1 [R=301,L]
# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
RewriteRule ^(.*)$ /$1/ [R=301,L]
# Standard ExpressionEngine Rewrite
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{QUERY_STRING} ^(gclid=.*)
RewriteRule ^(.+) /index.php?/ [L,PT]
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(themes|index\.php|admin\.php|favicon\.ico|index\.php|path\.php|php\.ini) [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
i.e., when you click on a pagination link, it removes the gclid
querystring and adds PXX to the URL and you get the updated results.
But on other sites with the exact same rules in place, the PXX just gets added after the gclid
querystring and you still get the same first page of results.
Anyone know why that might be? Or have a foolproof method for this scenario?
site.com/tours/made-up
? A search result page? You can probably use template routes to fix this issue (the first issue, not the second).