Welcome to WebmasterWorld Guest from 54.211.17.91

Forum Moderators: incrediBILL

Message Too Old, No Replies

site search after trailing slash

   
8:33 am on Aug 7, 2010 (gmt 0)

5+ Year Member



Is it possible to enable some sort of site search for content if a user types in a keyword after the trailing slash if there was no valid folder to go to?

For example,

www.foobarbazi.com/foo will result in a set of pages that has "foo" included them.

Thanks,

J2K
12:44 pm on Aug 7, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



welcome back, java2king!
what you could do is configure your server to internally rewrite such requests to a search script that returns the page of search results.
you should be sure that a 404 Not Found response is used if no relevant content is found.
otherwise you could be serving content for nonsense urls which would all return an essentially empty template.
11:40 am on Aug 9, 2010 (gmt 0)

5+ Year Member



what you could do is configure your server to internally rewrite such requests to a search script that returns the page of search results.

Just to expand on phranque's response a little. These rewrite rules can be specified in a .htaccess file using the Apache module mod_rewrite. You can do some pretty funky stuff using this but these rely on regular expressions so get ready to get your hands dirty!

There are loads of examples online though which should help you on your way.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month