Code solutions to PHP, JS, CSSCode source PHP, JS, CSS

Spread your code soluces to the world

Love me
Solucior » HTACCESS » Automatic search result page

Automatic search result page

01/27/2012 by Dux   -   5/5 (1 ratings)

Here is a simple method using htaccess to turn an URL www.yoursite.com/keyword to a search results page. Htaccess code obviously not include the search engine. It only transmits the variable q to be treated by your internal search engine.
Elegant and efficient solution to capture a indexing bot a on keyword page.

If your data is in MySQL database, you could use a query such as :
" SELECT * FROM my_table WHERE title LIKE '%".$q."%' "

Demo.

Example of URL : mac-free.com/screenshot

source code



 
Options +FollowSymLinks
RewriteEngine on
RewriteRule
^([^\.|/]+)$ index.php?q=$1 [L]
Rate this code     |     Copied : 2x

Comments for Automatic search result page

No comment
Add a comment Nickname
ZOOM