用空白变量重写URL

How can I rewrite the following URL's in htaccess?

1. domain.com/search.php?c=category&search=searchword&var3=variable&page=pagenumber
2. domain.com/search.php?c=category&search=searchword&var3=variable
3. domain.com/search.php?c=category&search=&var3=variable&page=pagenumber
4. domain.com/search.php?c=category&search=&var3=variable

I want the URL's to look as:

1. domain.com/search/category/searchword/variable/pagenumber
2. domain.com/search/category/searchword/variable
3. domain.com/search/category/variable/pagenumber
4. domain.com/search/category/variable

I have URL's 1 and 2 working in htaccess, but I need 3 and 4 working with a blank search variable.

htaccess:

RewriteRule ^search/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ search.php?c=$1&search=$2&var3=$3&page=$4 [L,QSA]
RewriteRule ^search/([^/]+)/([^/]+)/([^/]+)/?$ search.php?c=$1&search=$2&var3=$3[L,QSA]