Search Module url settings

Events happening in the community are now at Drupal community events on www.drupal.org.
geetha0320's picture

Hi Friends,

Need some help.. I have a website where search Module is being used to fetch results. But when we type " test " and click "Search" the url is something like this...

http://www.website.com/search/node/test. I am trying to remove that node from url when its displaying results.

Can anyone help me????

Comments

Use url_inbound_alter Method

rajeesh's picture

You can use url_inbound_alter function to achieve this which is part of the drupal core from version 7. Please take a look at this.
http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_url_inbound_alter/7

You can define this function in your custom module like
function mymodule_url_inbound_alter(&$path, $original_path, $path_language) {
}

Hope this will help you.

Thanks Rajeesh for such an

geetha0320's picture

Thanks Rajeesh for such an early response but the site is using Drupal 6 :( Will that work?

USe url_alter Module

rajeesh's picture

No, it won't work in D6. But in that case you can use the url alter module.

http://drupal.org/project/url_alter

Use Custom seach Module

karthid's picture

Hi Geetha,

You can try custom search module.
It can able to change only the node text. Not able to remove.

Custom search : http://drupal.org/project/custom_search

After installing custom_seach Module
Go to admin/settings/custom_search
Set Your own text: search/YOUR_CUSTOM_TEXT/[key]

Thanks,
Karthi

Thank you :)

geetha0320's picture

Thanks Rajeesh and Karthid for ur replies and timely help.. Will try them and get back if any issues..:)

same issue

geetha0320's picture

Hi all..

I tried karthid's suggested method but the requirement is either to remove the "node" or use a query string like ?q= but im not able to use the query string as its already used in other application so have to go for a new module which has similar functionality as Search module with no "node" in url.

I also tried removing the users tab from search module but it was still redirecting to the /node/ in url when keyword is entered.

Can u guys help!

tried url_alter

geetha0320's picture

I tried url_alter as suggested by rajeesh but since this an 2-3 year old site there are many custom_url_rewrite functions in my site's settings.php which should not be there to use url_alter module.

no help till now

geetha0320's picture

Couldn get any help till now...

write a small piece of url rewrite in .htaccess

anup_ns's picture

you try writing a url rewrite code in your .htaccess file.
check this out for an example
http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html

or
http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewrit...

Anup S
9959666366

tranminhhai's picture

Install Custom Search module
https://www.drupal.org/project/custom_search
go to
admin/config/search/custom_search

CUSTOM SEARCH PATHS
Enter your search path something like: search/[key]|custom search label
This will change your search url to "search/keyword"
But this url doesn't work yet
You need install Views module
go to Views Create a View Page has url "/search/%"
Custom Search URL and and Views Page URL must be the same
you can change "search" with what you need.
For Example: "mysearch/[key]"
and Views URL "mysearch/%"


Views Page:
Add Configure contextual filter: Search: Search Terms

Add your Format , Show and filter
the result page will show with your Format style your Views Page. This will override default search page format style

That's work for me

Bangalore

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week