Rearrange Site’s Function File
1. Log in to your user account of cPanel.
2. Go to the FILES section and click on File Manager.

The File Manager interface will open.
3. Browse functions.php file by following the path public_html>>wp-content >> themes.
4. Right-click the functions.php file and select 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 should change the structure of the search URL slug to the most optimum level.
Improve Search URL Slug with .htaccess
1. Log in to your cPanel account.
2. Open File Manager and edit the .htaccess file.
3. 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.

By applying any one of the methods, cPanel users can effectively amend the search URL slug of a WordPress site and improve the SEO.