Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By Jimboy on
Is it somehow possible to change the path the search uses from, let's say
search/node/keyword
to
search/keyword
or even
something/keyword?
Comments
Still really need this. If
Still really need this.
If the solution isn't simple, I'd be glad for a hint into the right direction!
Yes its possible
Install the Custom search module and set the path to
/search/
you can add your site's search for a custom search in browser's custom search using
www.example.com/search/%s
most browsers use the %s as the search query. Use %q it fails.
What's new and changing in PHP 8
Thank you very much for your
Thank you very much for your reply!
I installed the said module, but I can't seem to make it work. When using my search box, after clicking 'submit' the path is the one I want (for example 'mysearch/keyword'). But Drupal tells me the site wasn found.
So the form just posts to another URL, but there's nothing there to listen for it.
Any further tips?
Does your Core search work
Does your Core search work ?
If yes , then enable custom search and configure it.
Admin> config > custom search
then, change the search URL
make sure that you use simple letters
What's new and changing in PHP 8
Yes, my core search works. I
Yes, my core search works.
I already followed all the steps you described. If I search for something after having set up the custom path, I receive a "page not found" error.
only if you're not using the default Drupal core search module
Hello,
I was encountering the same issue and discovered this topic : http://drupal.org/node/887276, and the short answer is : "you should only use this feature if you're not using the default Drupal core search module."
So could anyone tell us how to change the core search path ?
Thanks in advance...
Search Path
Not sure if you ever got the answer you sought, but I thought I would post just in case anyone else was searching for the same answer.
In your theme's template.php you can set up a completely customized search that's fairly simple.
First I needed a $variable that I could use in a custom .tpl file. I also needed to only search in a specific content type(book). So in my theme's template.php file I added the following functions:
Remember the $variable we created in the _node_preprocess function...
To actually display the custom search_form you need to add the following in your .tpl file. Keep in mind that I needed this for a specific node->type therefore I added this to node-book.tpl.php in my theme folder. Make sure if you are using a custom theme (sub-theme) you have a copy of node.tpl.php in your theme folder as well.
print $book_search
-Scott
I have another solution but
I have another solution but it requires you either add to or create your own module.
I created a module that contains a set of functions I use on every site I work on so I just added this to that but it could easily be used in a separate module.
First you need a menu item in your module's hook_menu() function based off of the current search.module menu item:
Note that the $back and $_SERVER['DOCUMENT_ROOT'] portions of the file path are necessary for my serving environment and current Drupal setup for the site I am using this on. You may need to modify (or remove) that part for your own. You'll know if you do if you get the "cannot find blah blah blah" error that will get thrown at you otherwise.
Next we create (or add to) the YOURMODULENAME_init() function:
I have a function that returns a lot of useful information about the current page's uri that I use to populate $uri. You can create your own array to fit this by adding the following line before this code:
I find that sometimes when using arg() I get Drupal node path arguments (node/1) instead of the actual uri being shown to the user. That was my reason for creating the $uri thing, more portable.
Anyway, next we need the YOURMODULENAME_search_view function:
Then the YOURMODULENAME_search_get_keys() and YOURMODULENAME_search_data() functions:
You should notice that the $type used in the search module's functions is set to a static value of 'node' throughout the modified functions. Which means you won't be able to use this for searching anything other than nodes. It suits me just fine since I don't want users searching for user accounts (most of the sites I work on do not have them).
If you didn't already know, the second uri argument in the search path tells the search module what type of info to look for.
To change where the search page is located you'll have to create the appropriate menu items and modify the above code to reflect the new location.
If you cannot (or do not want to) use the custom search module this may be a better solution for you. It works great for my purposes and eventually I'm going to setup an admin option to change the location to whatever is set in that option.
Change search path
Hi,
I have a similar question. Where can I change the search path from
search/node/keyword
to
search/?key=keyword ?
Can it be achieved by using the custom search module? Thanks!
In drupal 7 it's as
In drupal 7 it's as following:
search/user/[key]|User
search/node to other
Install pathauto module,
go to /admin/config/search/path/add
Add Existing system path "search/node"
Add Path alias, What ever you want, "other"
yes.. it's working... thanks
yes.. it's working... thanks
replace search/node with some string
Yes, It worked like a charm.. Thanks
Replacing search/node to other
It is working Fine.... Thanks...
Modify drupal search path