How do i change the url of wordpress search results? -



How do i change the url of wordpress search results? -

by default wordpress search results go sitename.com/?s=terms changes sitename.com/search/?s=terms

i have tried using the

fb_change_search_url_rewrite() { if ( is_search() && ! empty( $_get['s'] ) ) { wp_redirect( home_url( "/search/" ) . urlencode( get_query_var( 's' ) ) ); exit(); } } add_action( 'template_redirect', 'fb_change_search_url_rewrite' );

this close when search goes search/searchterm not have ?s= in url

alternatively, can alter rule in .htaccess

add next on line after "rewritebase /":

rewriterule ^?s=(.*)$ search/?s=$1

see reference here: http://wordpress.org/support/topic/change-default-search-string-s-to-permalink-structure

wordpress

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -