Question: > 
> **Possible Duplicate:**  
> 
> [How to: URL re-writing in PHP?](https://stackoverflow.com/questions/1039725/how-to-url-re-writing-in-php) 
> 
> 
> 

I want to pass a clean url through search form in **index.php(mvc)**

ie:

```
 <form>
    <input type="text" name="search" onClick="if(this.value=='Search') this.value=''"    onBlur="if(this.value=='') this.value='Search'" value="Search"/>
    <button>Search</button>
</form> 

```

It is sent to **index.php** and depending on the search parameter i.e `$_GET['search']` it is passed to search controller 

But instead of `index.php?search=xyz` i want to pass `/search/xyz`.

Answer: 
If you are using apache read about [mod\_rewrite](http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html) you should add rewrite rule which will rewrite `/search/xyz` to `index.php?search=xyz` something like:

```
RewriteEngine on 
Options +FollowSymlinks
RewriteBase / 

RewriteRule ^search/(.*) index.php?search=$1 [R]

```
you can do it in the onsubmit function of the form 

```
<form onsubmit="myFunc();">  
..  

```

in js:

```
function myFunc(){  
  var search_input = document.getElementById("search_input_id");
  window.location = "http://www.yoursite.com/search/"+search_input.value;}

```

I am not sure this will work, but this you get the idea. 

UPD: in your case: `<button onclick="muFunc();">` 

And in case you meant "how to redirect 'http://www.yoursite.com/search/search\_term' to index.php?search=search\_term " Ruben Nagoga is 100% right