├── nice-search.php └── readme.md /nice-search.php: -------------------------------------------------------------------------------- 1 | using_permalinks() ) { 14 | // Sorry, this plugin isn't going to work on this site 15 | return; 16 | } 17 | 18 | $search_base = $wp_rewrite->search_base; 19 | if ( is_search() && !is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) { 20 | wp_redirect( home_url( "/{$search_base}/" . urlencode( get_query_var( 's' ) ) ) ); 21 | exit(); 22 | } 23 | } 24 | 25 | add_action( 'template_redirect', 'cws_nice_search_redirect' ); 26 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Nice Search # 2 | Contributors: markjaquith 3 | Donate link: http://txfx.net/wordpress-plugins/donate 4 | Tags: redirect, canonical, search 5 | Requires at least: 4.0 6 | Tested up to: 4.2.2 7 | Stable tag: 0.5 8 | 9 | Redirects search URLs from ?s=FOO to /search/foo and converts spaces to + symbols 10 | 11 | ## Description ## 12 | 13 | This simple plugin (no configuration) redirects `?s=FOO` search URLs to the nicer `/search/FOO` versions. Requires pretty permalinks. 14 | 15 | ## Installation ## 16 | 17 | 1. Upload the `nice-search` folder to your `/wp-content/plugins/` directory 18 | 2. Activate the "Nice Search" plugin in your WordPress administration interface 19 | 3. Done! 20 | 21 | ## Frequently Asked Questions ## 22 | 23 | = Does this work with PATHINFO (index.php) permalinks? = 24 | 25 | Yes. 26 | 27 | ## Changelog ## 28 | 29 | ### 0.5 ### 30 | * Respect custom `$wp_rewrite->search_base` values 31 | 32 | ### 0.4 ### 33 | * Properly handle urlencoded characters (non-English languages: you want this!) 34 | * Include a hotfix for WordPress ticket [#13961](http://core.trac.wordpress.org/ticket/13961), which enables the above fix to work. 35 | * Use proper WP API functions (enables PATHINFO permalinks) 36 | 37 | ### 0.3 ### 38 | * First version in repository --------------------------------------------------------------------------------