How can I change the search URL from /?s=my-word to /busca/?s=my-word ?
I know how to change to /busca/my-word, but I really need the "s" parameter.
Thanks.
From WPEngineer (with edits):
Add the following to functions.php in your theme:
function fb_change_search_url_rewrite() {
if ( is_search() && ! empty( $_GET['s'] ) ) {
wp_redirect( home_url( "/busca/?s=" ) . urlencode( get_query_var( 's' ) ) );
exit();
}
}
add_action( 'template_redirect', 'fb_change_search_url_rewrite' );
Add the following to your htaccess file:
RewriteCond %{QUERY_STRING} ^s=(.*)$ [NC]
RewriteRule ^$ /busca/%1 [NC,QSA,L]
Note: Code is untested
Edit: Minor modifications made to answer the question more thoroughly