Forum Moderators: phranque

Message Too Old, No Replies

rewrite for search

mod_rewrite for search

         

ensteve

7:16 pm on Oct 28, 2006 (gmt 0)

10+ Year Member



I am looking to rewrite my search URLs to be similar to that of google or digg, as follows:

[mydomain.com...]

to

[mydomain.com...]

It would also need to be able to accept all variables not only limited to "s".

Thanks.
Sam

crosescu

10:00 pm on Oct 30, 2006 (gmt 0)

10+ Year Member



Hi,

you can try the folowing below:

RewriteCond %{query_string} s=(.*)
RewriteRule ^.*search$ /search.php?s=%1 [L]

This simply serves /search.php whenever "search" is requested with one argument in the query string

You may need to add the directive Options +FollowSymLinks ahead of your RewriteEngine on directive as per below:

Options +FollowSymLinks
RewriteEngine on

ensteve

12:54 am on Nov 3, 2006 (gmt 0)

10+ Year Member



Perfect!

Thanks for your help.