Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Disable search
I do not want to allow search on a site. Even though there is no search box on the site i occasionally get hits on urls with “q=some search term” which makes the page be empty. Is there a way to disable the search?
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#2 2008-06-13 21:10:24
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Disable search
You could display a message on empty search pages using <txp:if_search>
. Or use this tag with zem_redirect to redirect them somewhere else.
Offline
Re: Disable search
Or at the top of your page:
<txp:php>unset($_GET['q']);</txp:php>
Offline
Re: Disable search
Thanks both for your suggestions. I went with ruud’s which makes my example from the initial post return a 404. Perfect.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#5 2008-06-14 16:17:53
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Disable search
ruud wrote:
Or at the top of your page:
<txp:php>unset($_GET['q']);</txp:php>
Ruud
can I assume that the same would work with ‘c’ instead of ‘q’?
Offline
Re: Disable search
@Els: sure, that works for all GET parameters.
Offline
Re: Disable search
Just being nosey Els, but why would you want it to work with “c”?
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#8 2008-06-14 18:58:28
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Disable search
Because I stopped using categories quite a while ago, and – though I’d been using /category/category-name URLs for ages – I’m still getting requests for ?c=blah pages sometimes. And they never give you a 404, only, just like the search in MattD’s example, an empty page. I’ve been using rewrite rules in .htaccess to avoid that, but a 404 would be better of course.
Offline
Re: Disable search
Doesn’t zem’s redirect plug-in work for that?
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#10 2008-06-14 20:49:52
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Disable search
Hmm… could be. But I never got it to work nicely with tru_tags.
Offline
Pages: 1