Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  How-Tos  >  How to Use Webuzo to Improve a WordPress Site’s Search URL Slug?
Top Scroll

How to Use Webuzo to Improve a WordPress Site’s Search URL Slug?

 3 min

SEO-friendly URLs are beneficial for indexing. But, the secret to search engine ranking lies in the platform’s default search URL structure. We will show how users with Webuzo can improve the search URL slug of a WordPress site (http://www.example.com/?s=search-term) to raise its overall SEO status.

With a few adjustments, your search URL slugs will be more in tune with your site’s permalinks format. We have talked about configuring the Functions File and changing the .htaccess file. 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.

Table of Contents

Did you know!

Configuring your WordPress website with SEO-friendly URLs will only index posts and pages which, is not enough to improve SEO ranking. The structure of these search URLs should also seem genuine and easy to read for search engine crawlers to optimize the search pages for search engines.

Rearrange Site’s Function File

1. Log in to your user account of Webuzo.

2. Go to the Server Utilities 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.

5. Choose the TextArea editor.

The functions.php file will open in the TextArea 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 & Close.

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 Webuzo account.

2. Open File Manager and edit the .htaccess file in public_html.

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 & Close.

If you are a Webuzo user, you can use any one of these methods and enhance the search URL slug of a WordPress site effectively boosting the overall SEO.

P.S.

Users can also use the FTP client to download the functions.php or .htaccess file, edit and then reupload them on the server.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.