views:

26

answers:

2

I need a help, does anyone can tell me how to change a url

"http://www.domain.com/search.php?key=+Ebooks&type=title&Submit=Search"

to

"http://www.domain.com/keyword- keyword- keyword.html".

i have written following htaccess code but its not working.

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteRule search-(.*)-(.*)-(.*)\.html search.php?key=$1&type=$2&page=$3
</IfModule>
A: 

What exactly does not work? Is anything happening?

I am not 100% sure but I think you have to do it this way:

search-(.*?)-(.*?)-(.*?)\.html search.php?key=$1&type=$2&page=$3

Notice the ? behind the asterisks. It indicates to match a string as early as possible.

Felix Kling
A: 

Try this:

RewriteRule search-([^-]*)-([^-]*)-([^-]*)\.html search.php?key=$1&type=$2&page=$3
Stuart Sierra