Welcome to WebmasterWorld Guest from 54.147.44.13

Forum Moderators: incrediBILL

Message Too Old, No Replies

site search after trailing slash

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

New User

10+ Year Member

joined:June 25, 2005
posts:5
votes: 0


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)

Administrator

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

joined:Aug 10, 2004
posts:10542
votes: 8


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)

Junior Member

5+ Year Member

joined:Dec 5, 2008
posts: 94
votes: 0


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.