How to Improve the Search URL Slug of a WordPress Site via cPanel?
To improve search URL Slug of wordpress site or any website for that matter, reliable web hosting is essential to improve SEO rankings. In this case of URL, you can choose URL hosting plans assuring higher uptime, top notch security, 24/7 customer support and more.
With few modifications, your search URL slugs will be more in line with the site’s permalinks format.
Here, the idea is to change the site’s present search URL slug: http://www.example.com/?s=search-term into this http://www.example.com/search/search-term.
Configuring WordPress websites with SEO-friendly URLs will only index posts and pages which is not enough to improve SEO ranking. The structure of these search URLs must seem genuine and easy to read for search engine crawlers to improve search pages for search engines.
Re-Arrange Site’s Function File
- Log in to your user account of cPanel.
- Go to the FILES section and click on File Manager.

- The file manager interface opens
3. Browse functions.php file by the following the path public_html>>wp-content>>themes.
4. Right click functions.php file and select the Edit.

- The file will open in the editor window.
5. Paste the given code at the end of the file.
/**
* Change search page slug.
*/
function wp_change_search_url() {
if ( is_search() && ! empty( $_GET['s'] ) ) {
wp_redirect( home_url( "/search/" ) . urlencode( get_query_var( 's' ) ) );
exit();
}
}
add_action(‘template_redirect’, ‘wp_change_search_url’);
6. Click save changes and close the editor.

It must change the structure of the search URL slug to the most improved level.
How to Improve Search URL Slug with .htaccess
- Log in to your cPanel account.
- Open File Manager and edit the .htaccess file.
- Paste this code at the end of the file:
Change WordPress search URL slug
RewriteCond %{QUERY_STRING} \\?s=([^&]+)[NC]
RewriteRule ^$/search/%1/?[NC,R,L]
4. Click Save Changes and Close the editor.

Conclusion
By following either of the methods, cPanel users can effectively amend the search URL Slug of wordpress site and significantly improve SEO.