softmaji-header-wbg-min
softmaji-header-wbg-min
softmaji-blue-header-min
softmaji-blue-header-min
  • Home
  • Services
    • Website Designing
      • Responsive Website Design
      • Static Website Design
      • Website Redesign
      • Landing Page Design
    • Website Development
      • PHP Website Development
      • WordPress Website Development
      • Ecommerce Website Development
      • Custom Website Development
    • Digital Marketing
      • Google Adwords/PPC
      • Facebook Promotion
    • SEO Service
  • Trainings
    • Learn Web Development
    • Learn Graphics Design
    • Learn Business Communication Skills
  • Pricing
  • Portfolio
  • Events
  • Offers
  • Contact Us

How to Improve the Search URL Slug of a WordPress Site via cPanel?

HomeHow to Improve the Search URL Slug of a WordPress Site via cPanel?

Offer Expire Soon..


Only New User..


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 you how cPanel users can improve the search URL slug of any WordPress site (http://www.example.com/?s=search-term) to raise its overall SEO status. Additionally, reliable web hosting is the key to improving the SEO rankings of a website. In the scenario of URL, you can opt for URL hosting plans assuring higher uptime, top-notch security, 24/7 customer support and more. 

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

Rearrange Site’s Function File

Improve Search URL Slug with .htaccess

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.

Table of Contents

Toggle
  • Rearrange Site’s Function File
  • Improve Search URL Slug with .htaccess

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.

Note: You can refer to this article to help you understand How To Edit A .htaccess File Through The cPanel File Manager?

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.

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.

Faizan Khan
18
Latest News
Prev PostHow to Change a WordPress Site’s Search URL Slug via DirectAdmin?May 11, 2024
Next PostHow to Create a Website in WordPress: In-Depth Guide with VideosMay 11, 2024

Related items

otpless-issue
Latest News

OTPLess Not Working? Here’s What Happened!

Imagine this: You run a business, and suddenly, your customers can’t log in to your websit

SoftMaji InfoTech
20/06/2025
8
Latest News

How To Install WordPress Blog?

Let’s see how to install WordPress blog on your WordPress hosting account. Let’s

Faizan Khan
14/05/2024
149
Latest News

How to Install a Theme in WordPress?

Steps to install a theme in WordPress: Log in to WordPress. Navigate to Appearance and cli

Faizan Khan
14/05/2024
135
softmaji-header-wbg-min
SoftMaji is one of the affordable web development company in the web development industry. You don’t have to go searching anywhere for finding a reliable web development partner because we have crafted web development solutions that can fill the void left by others in the market.
Services
  • News Portal Development
  • Custom Website Development
  • PHP Website Development
  • Ecommerce Website Development
  • WordPress Website Development
Shortlinks
  • Blog
  • Offers
  • Events
  • Pricing
  • Reviews
  • Portfolio
  • Our Team
  • Payment Options
  • Explore Packages
Company
  • FAQ
  • Careers
  • Sitemap
  • Feedback
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions
  • Refund And Cancellation
Contact Us
4/40 Vipul Khand , Gomti Nagar Lucknow
Uttar Pradesh 226010
Landline - +915223162418
Email - hello@softmaji.in
Office Time Mon - Sat
(10:00AM - 5:00PM)
Sunday Close
+91 9795405324
Lucknow , Uttar Pradesh
Copyright © 2022. All Rights Reserved.