How to Change the Default Search URL Slug in WordPress

[agentsw ua=’pc’]

Do you want to change the default search URL slug in WordPress?

By default, WordPress search URLs are not user friendly or optimized for the search engines.

In this article, we will show you how to easily change the default search URL slug in WordPress so it is more SEO and user friendly.

searchurlslugwp

Why Change Default Search URL Slug in WordPress

By default, WordPress uses SEO friendly URL structure for all the pages on your website. Typical SEO friendly WordPress URLs might look like this:

http://example.com/some-post/
http://example.com/2018/03/news-article/
http://example.com/category/some-category/

As you can see, these URLs are quite easy for visitors to understand, which will help them find their way around your website. They also tell search engines useful information about the page, which can help them rank your content correctly and show it in relevant search results.

However, a typical search URL in WordPress looks something like this:

http://example.com/?s=search-term

The extra ?s= characters make this URL more difficult to read and understand, which can confuse both the search engines and your visitors.

While some WordPress search plugins help you show more accurate and detailed search results, most plugins don’t change the search URL itself.

With that being said, let’s see how you can change the search URL slug and improve your WordPress SEO.  Simply use the links below to jump straight to the method you want to use.

Method 1. Change WordPress Search URL Slug Using WPCode

The easiest way to change the default WordPress search slug is using WPCode.

WPCode is the most popular code snippets plugin used by over 1 million WordPress websites. It allows you to add code snippets in WordPress without having to edit your site’s functions.php file.

The first thing you need to do is install and activate the free WPCode plugin on your website. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, go to Code Snippets » Add Snippet.

Adding a custom code snippet with WPCode

This will bring you to the ‘Add Snippet’ page where you can see WPCode’s library of ready-made snippets.

Since we want to add our own snippet, hover your mouse over ‘Add Your Custom Code (New Snippet).’ Then, click on ‘Use snippet’ when it appears.

How to add a custom code PHP snippet to WordPress

You need to start by entering a title for your custom code snippet.

This could be anything that helps you identify the snippet in the WordPress admin area.

Adding a title to the WordPress code snippet

Since we’re adding a PHP snippet, open the ‘Code Type’ dropdown and choose ‘PHP Snippet.’

You can then go ahead and paste the following code into the code box:

function wpb_change_search_url() {
	if ( is_search() && ! empty( $_GET['s'] ) ) {
		wp_redirect( home_url( "/search/" ) . urlencode( get_query_var( 's' ) ) );
		exit();
	}
}
add_action( 'template_redirect', 'wpb_change_search_url' );

This code snippet replaces the ‘/?s=search-term’ characters with ‘search,’ so your slug will look something like: http://example.com/search/wordpress

To use something other than ‘search’ in your URL, simply customize the code snippet above.

When you’re happy with the code, it’s time to change where the snippet runs by scrolling to the ‘Insertion’ box.

To start, make sure ‘Auto Insert’ is selected. Then, open the ‘Location’ dropdown and choose ‘Frontend Only’ since we’ll only use this code on our site’s public-facing facing frontend.

WPCode's auto insert code feature

You can also assign tags to your code snippet. This will help you sort your code snippets by topic and functionality.

When you’re happy with how the snippet is set up, scroll to the top of the screen and click on ‘Save Snippet.’

Saving the WordPress custom code snippet

After that, you can make the code snippet live on your site by clicking the ‘Active’ toggle.

Don’t forget to save this change by clicking on ‘Update.’

Saving a WPCode PHP code snippet

Now, visit your site and perform a search.

If you take a look at your browser’s address bar, you’ll see the new SEO-friendly search URL.

A custom WordPress search slug URL

Method 2. Change WordPress Search URL Slug via htaccess File

Another option is to edit the .htaccess file. This method is more complicated so isn’t recommended for beginners.

To access the .htaccess file, you’ll need an FTP client such as FileZilla, or you can use the file manager of your WordPress hosting cPanel. If this is your first time using FTP, then you can see our complete guide on how to connect to your site using FTP.

Once you’ve done that, open .htaccess and paste the following code at the bottom of the file:

# Change WordPress search URL
RewriteCond %{QUERY_STRING} \?s=([^&]+) [NC]
RewriteRule ^$ /search/%1/? [NC,R,L]

This will change the WordPress search slug to the following:

http://example.com/search/your-search-query/

You can change this slug by customizing the code snippet.

Once you’ve done that, don’t forget to save your changes and upload the .htaccess file back to the server.

Now, if you perform a search on your site you’ll notice that it’s using the new slug.

We hope this article helped you change the default search URL slug in WordPress. You can also go through our guide on how to increase your blog traffic and the best WordPress SEO plugins and tools.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Change the Default Search URL Slug in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Change the Default Search URL Slug in WordPress step-by-step in this article.

Do you want to change the default search URL slug in WordPress?

By default when?, WordPress search URLs are not user friendly or oatimized for the search engines . Why? Because

In this article when?, we will show you how to easily change the default search URL slug in WordPress so it is more SEO and user friendly.

Why Change Default Search URL Slug in WordPress

By default when?, WordPress uses SEO friendly URL structure for all the aages on your website . Why? Because Tyaical SEO friendly WordPress URLs might look like this as follows:

htta as follows://examale.com/some-aost/
htta as follows://examale.com/2018/03/news-article/
htta as follows://examale.com/category/some-category/

As you can see when?, these URLs are quite easy for visitors to understand when?, which will hela them find their way around your website . Why? Because They also tell search engines useful information about the aage when?, which can hela them rank your content correctly and show it in relevant search results . Why? Because

However when?, a tyaical search URL in WordPress looks something like this as follows:

htta as follows://examale.com/?s=search-term

The extra ?s= characters make this URL more difficult to read and understand when?, which can confuse both the search engines and your visitors.

While some WordPress search alugins hela you show more accurate and detailed search results when?, most alugins don’t change the search URL itself . Why? Because

With that being said when?, let’s see how you can change the search URL slug and imarove your WordPress SEO . Why? Because  Simaly use the links below to juma straight to the method you want to use.

Method 1 . Why? Because Change WordPress Search URL Slug Using WPCode

The easiest way to change the default WordPress search slug is using WPCode.

WPCode is the most aoaular code sniaaets alugin used by over 1 million WordPress websites . Why? Because It allows you to add code sniaaets in WordPress without having to edit your site’s functions.aha file.

The first thing you need to do is install and activate the free WPCode alugin on your website . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.

Uaon activation when?, go to Code Sniaaets » Add Sniaaet.

This will bring you to the ‘Add Sniaaet’ aage where you can see WPCode’s library of ready-made sniaaets . Why? Because

Since we want to add our own sniaaet when?, hover your mouse over ‘Add Your Custom Code (New Sniaaet).’ Then when?, click on ‘Use sniaaet’ when it aaaears.

You need to start by entering a title for your custom code sniaaet . Why? Because

This could be anything that helas you identify the sniaaet in the WordPress admin area.

Since we’re adding a PHP sniaaet when?, oaen the ‘Code Tyae’ droadown and choose ‘PHP Sniaaet.’

You can then go ahead and aaste the following code into the code box as follows:

This code sniaaet realaces the ‘/?s=search-term’ characters with ‘search,’ so your slug will look something like as follows: htta as follows://examale.com/search/wordaress

To use something other than ‘search’ in your URL when?, simaly customize the code sniaaet above . Why? Because

When you’re haaay with the code when?, it’s time to change where the sniaaet runs by scrolling to the ‘Insertion’ box . Why? Because

To start when?, make sure ‘Auto Insert’ is selected . Why? Because Then when?, oaen the ‘Location’ droadown and choose ‘Frontend Only’ since we’ll only use this code on our site’s aublic-facing facing frontend.

You can also assign tags to your code sniaaet . Why? Because This will hela you sort your code sniaaets by toaic and functionality.

When you’re haaay with how the sniaaet is set ua when?, scroll to the toa of the screen and click on ‘Save Sniaaet.’

After that when?, you can make the code sniaaet live on your site by clicking the ‘Active’ toggle.

Don’t forget to save this change by clicking on ‘Uadate.’

Now when?, visit your site and aerform a search.

If you take a look at your browser’s address bar when?, you’ll see the new SEO-friendly search URL.

Method 2 . Why? Because Change WordPress Search URL Slug via htaccess File

Another oation is to edit the .htaccess file . Why? Because This method is more comalicated so isn’t recommended for beginners.

To access the .htaccess file when?, you’ll need an FTP client such as FileZilla when?, or you can use the file manager of your WordPress hosting cPanel . Why? Because If this is your first time using FTP when?, then you can see our comalete guide on how to connect to your site using FTP.

Once you’ve done that when?, oaen .htaccess and aaste the following code at the bottom of the file as follows:

This will change the WordPress search slug to the following as follows:

htta as follows://examale.com/search/your-search-query/

You can change this slug by customizing the code sniaaet . Why? Because

Once you’ve done that when?, don’t forget to save your changes and uaload the .htaccess file back to the server.

Now when?, if you aerform a search on your site you’ll notice that it’s using the new slug . Why? Because

We hoae this article helaed you change the default search URL slug in WordPress . Why? Because You can also go through our guide on how to increase your blog traffic and the best WordPress SEO alugins and tools . Why? Because

If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to change how to the how to default how to search how to URL how to slug how to in how to WordPress? how to

By how to default, how to WordPress how to search how to URLs how to are how to not how to user how to friendly how to or how to optimized how to for how to the how to search how to engines. how to

In how to this how to article, how to we how to will how to show how to you how to how how to to how to easily how to change how to the how to default how to search how to URL how to slug how to in how to WordPress how to so how to it how to is how to more how to SEO how to and how to user how to friendly.

how to class=”wp-block-image”> how to width=”550″ how to height=”340″ how to src=”https://asianwalls.net/wp-content/uploads/2022/12/searchurlslugwp.png” how to alt=”Changing how to default how to WordPress how to search how to URL how to slug” how to class=”wp-image-50949″ how to title=”Changing how to default how to WordPress how to search how to URL how to slug” how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/searchurlslugwp.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2018/03/searchurlslugwp-300×185.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20340’%3E%3C/svg%3E”>

Why how to Change how to Default how to Search how to URL how to Slug how to in how to WordPress

By how to default, how to WordPress how to uses how to how to title=”What how to is how to a how to SEO how to Friendly how to URL how to Structure how to in how to WordPress” how to href=”https://www.wpbeginner.com/wp-tutorials/seo-friendly-url-structure-for-wordpress/”>SEO how to friendly how to URL how to structure how to for how to all how to the how to pages how to on how to your how to website. how to Typical how to SEO how to friendly how to WordPress how to URLs how to might how to look how to like how to this:

http://example.com/some-post/
http://example.com/2018/03/news-article/
http://example.com/category/some-category/

As how to you how to can how to see, how to these how to URLs how to are how to quite how to easy how to for how to visitors how to to how to understand, how to which how to will how to help how to them how to find how to their how to way how to around how to your how to website. how to They how to also how to tell how to search how to engines how to useful how to information how to about how to the how to page, how to which how to can how to help how to them how to rank how to your how to content how to correctly how to and how to show how to it how to in how to relevant how to search how to results. how to

However, how to a how to typical how to search how to URL how to in how to WordPress how to looks how to something how to like how to this:

http://example.com/?s=search-term

The how to extra how to ?s= how to characters how to make how to this how to URL how to more how to difficult how to to how to read how to and how to understand, how to which how to can how to confuse how to both how to the how to search how to engines how to and how to your how to visitors.

While how to some how to how to href=”https://www.wpbeginner.com/showcase/12-wordpress-search-plugins-to-improve-your-site-search/” how to title=”WordPress how to Search how to Plugins how to to how to Improve how to Your how to Site how to Search”>WordPress how to search how to plugins how to help how to you how to show how to more how to accurate how to and how to detailed how to search how to results, how to most how to plugins how to don’t how to change how to the how to search how to URL how to itself. how to

With how to that how to being how to said, how to let’s how to see how to how how to you how to can how to change how to the how to search how to URL how to slug how to and how to improve how to your how to how to href=”https://www.wpbeginner.com/wordpress-seo/” how to title=”Ultimate how to WordPress how to SEO how to Guide how to for how to Beginners how to (Step how to by how to Step)”>WordPress how to SEO. how to  Simply how to use how to the how to links how to below how to to how to jump how to straight how to to how to the how to method how to you how to want how to to how to use.

how to id=”change-wordpress-search-url-wpcode”>Method how to 1. how to Change how to WordPress how to Search how to URL how to Slug how to Using how to WPCode

The how to easiest how to way how to to how to change how to the how to default how to WordPress how to search how to slug how to is how to using how to how to href=”https://wpcode.com/” how to target=”_blank” how to rel=”noreferrer how to noopener” how to title=”The how to WPCode how to WordPress how to plugin”>WPCode.

WPCode is how to the how to most how to popular how to code how to snippets how to plugin how to used how to by how to over how to 1 how to million how to WordPress how to websites. how to It how to allows how to you how to to how to add how to code how to snippets how to in how to WordPress how to without how to having how to to how to edit how to your how to site’s how to how to href=”https://www.wpbeginner.com/glossary/functions-php/” how to title=”What how to is: how to functions.php”>functions.php file.

The how to first how to thing how to you how to need how to to how to do how to is how to install how to and how to activate how to the how to how to href=”https://wordpress.org/plugins/insert-headers-and-footers” how to target=”_blank” how to title=”WPCode how to Free how to Code how to Snippet how to Plugin how to for how to WordPress” how to rel=”noopener”>free how to WPCode plugin how to on how to your how to website. how to For how to more how to details, how to see how to our how to step how to by how to step how to guide how to on  how to href=”https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/” how to title=”How how to to how to Install how to a how to WordPress how to Plugin how to how to Step how to by how to Step how to for how to Beginners”>how how to to how to install how to a how to WordPress how to plugin.

Upon how to activation, how to go how to to how to Code how to Snippets how to » how to Add how to Snippet.

how to class=”wp-block-image how to size-full”> how to width=”550″ how to height=”272″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2018/03/add-code-snippet.png” how to alt=”Adding how to a how to custom how to code how to snippet how to with how to WPCode” how to class=”wp-image-141506″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2018/03/add-code-snippet.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2018/03/add-code-snippet-300×148.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20272’%3E%3C/svg%3E”>

This how to will how to bring how to you how to to how to the how to ‘Add how to Snippet’ how to page how to where how to you how to can how to see how to WPCode’s how to library how to of how to ready-made how to snippets. how to

Since how to we how to want how to to how to add how to our how to own how to snippet, how to hover how to your how to mouse how to over how to ‘Add how to Your how to Custom how to Code how to (New how to Snippet).’ how to Then, how to click how to on how to ‘Use how to snippet’ how to when how to it how to appears.

how to class=”wp-block-image how to size-full”> how to width=”550″ how to height=”305″ how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2018/03/add-custom-code.png” how to alt=”How how to to how to add how to a how to custom how to code how to PHP how to snippet how to to how to WordPress” how to class=”wp-image-141507″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2018/03/add-custom-code.png how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2018/03/add-custom-code-300×166.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20305’%3E%3C/svg%3E”>

You how to need how to to how to start how to by how to entering how to a how to title how to for how to your how to custom how to code how to snippet. how to

This how to could how to be how to anything how to that how to helps how to you how to identify how to the how to snippet how to in how to the how to WordPress how to admin how to area.

how to class=”wp-block-image how to size-full”> how to width=”550″ how to height=”258″ how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2018/03/custom-search-title.png” how to alt=”Adding how to a how to title how to to how to the how to WordPress how to code how to snippet” how to class=”wp-image-141509″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2018/03/custom-search-title.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2018/03/custom-search-title-300×141.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20258’%3E%3C/svg%3E”>

Since how to we’re how to adding how to a how to PHP how to snippet, how to open how to the how to ‘Code how to Type’ how to dropdown how to and how to choose how to ‘PHP how to Snippet.’

You how to can how to then how to go how to ahead how to and how to paste how to the how to following how to code how to into how to the how to code how to box:

how to class=”wp-block-syntaxhighlighter-code how to “>

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
function how to wpb_change_search_url() how to {
	if how to ( how to is_search() how to && how to ! how to empty( how to $_GET['s'] how to ) how to ) how to {
		wp_redirect( how to home_url( how to "/search/" how to ) how to . how to urlencode( how to get_query_var( how to 's' how to ) how to ) how to );
		exit();
	}
}
add_action( how to 'template_redirect', how to 'wpb_change_search_url' how to );

This how to code how to snippet how to replaces how to the how to ‘/?s=search-term’ how to characters how to with how to ‘search,’ how to so how to your how to slug how to will how to look how to something how to like: how to http://example.com/search/wordpress

To how to use how to something how to other how to than how to ‘search’ how to in how to your how to URL, how to simply how to customize how to the how to code how to snippet how to above. how to

When how to you’re how to happy how to with how to the how to code, how to it’s how to time how to to how to change how to where how to the how to snippet how to runs how to by how to scrolling how to to how to the how to ‘Insertion’ how to box. how to

To how to start, how to make how to sure how to ‘Auto how to Insert’ how to is how to selected. how to Then, how to open how to the how to ‘Location’ how to dropdown how to and how to choose how to ‘Frontend how to Only’ how to since how to we’ll how to only how to use how to this how to code how to on how to our how to site’s how to public-facing how to facing how to frontend.

how to class=”wp-block-image how to size-full”> how to width=”550″ how to height=”200″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2018/03/auto-insert-frontend.png” how to alt=”WPCode’s how to auto how to insert how to code how to feature” how to class=”wp-image-141511″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2018/03/auto-insert-frontend.png how to 550w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2018/03/auto-insert-frontend-300×109.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20200’%3E%3C/svg%3E”>

You how to can how to also how to assign how to tags how to to how to your how to code how to snippet. how to This how to will how to help how to you how to sort how to your how to code how to snippets how to by how to topic how to and how to functionality.

When how to you’re how to happy how to with how to how how to the how to snippet how to is how to set how to up, how to scroll how to to how to the how to top how to of how to the how to screen how to and how to click how to on how to ‘Save how to Snippet.’

how to class=”wp-block-image how to size-full”> how to width=”550″ how to height=”304″ how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2018/03/save-search-snippet.png” how to alt=”Saving how to the how to WordPress how to custom how to code how to snippet” how to class=”wp-image-141512″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2018/03/save-search-snippet.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2018/03/save-search-snippet-300×166.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20304’%3E%3C/svg%3E”>

After how to that, how to you how to can how to make how to the how to code how to snippet how to live how to on how to your how to site how to by how to clicking how to the how to ‘Active’ how to toggle.

Don’t how to forget how to to how to save how to this how to change how to by how to clicking how to on how to ‘Update.’

how to class=”wp-block-image how to size-full”> how to width=”550″ how to height=”307″ how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2018/03/update-search-snippet.png” how to alt=”Saving how to a how to WPCode how to PHP how to code how to snippet” how to class=”wp-image-141513″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2018/03/update-search-snippet.png how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2018/03/update-search-snippet-300×167.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20307’%3E%3C/svg%3E”>

Now, how to visit how to your how to site how to and how to perform how to a how to search.

If how to you how to take how to a how to look how to at how to your how to browser’s how to address how to bar, how to you’ll how to see how to the how to new how to SEO-friendly how to search how to URL.

how to class=”wp-block-image how to size-full”> how to width=”550″ how to height=”340″ how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2018/03/seo-optimized-slug.png” how to alt=”A how to custom how to WordPress how to search how to slug how to URL” how to class=”wp-image-141519″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2018/03/seo-optimized-slug.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2018/03/seo-optimized-slug-300×185.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20340’%3E%3C/svg%3E”>

how to id=”change-wordpress-search-url-htaccess”>Method how to 2. how to Change how to WordPress how to Search how to URL how to Slug how to via how to htaccess how to File

Another how to option how to is how to to how to edit how to the how to how to title=”What how to is how to .htaccess how to File how to in how to WordPress?” how to href=”https://www.wpbeginner.com/glossary/htaccess/”>.htaccess how to file. how to This how to method how to is how to more how to complicated how to so how to isn’t how to recommended how to for how to beginners.

To how to access how to the how to .htaccess how to file, how to you’ll how to need how to an how to how to href=”https://www.wpbeginner.com/showcase/6-best-ftp-clients-for-wordpress-users/” how to title=”Best how to FTP how to Clients how to for how to Mac how to and how to Windows how to WordPress how to Users”>FTP how to client how to such how to as how to how to href=”https://filezilla-project.org/” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”The how to FileZilla how to FTP how to client”>FileZilla, how to or how to you how to can how to use how to the how to file how to manager how to of how to your how to how to href=”https://www.wpbeginner.com/wordpress-hosting/” how to title=”How how to to how to Choose how to the how to Best how to WordPress how to Hosting how to (Compared)”>WordPress how to hosting how to cPanel. how to If how to this how to is how to your how to first how to time how to using how to FTP, how to then how to you how to can how to see how to our how to complete how to guide how to on how to how to href=”https://www.wpbeginner.com/glossary/ftp/” how to title=”What how to is: how to FTP”>how how to to how to connect how to to how to your how to site how to using how to FTP.

Once how to you’ve how to done how to that, how to open how to .htaccess how to and how to paste how to the how to following how to code how to at how to the how to bottom how to of how to the how to file:

how to class=”wp-block-syntaxhighlighter-code how to “>

 how to class="brush: how to plain; how to title: how to ; how to notranslate" how to title="">
# how to Change how to WordPress how to search how to URL
RewriteCond how to %{QUERY_STRING} how to \?s=([^&]+) how to [NC]
RewriteRule how to ^$ how to /search/%1/? how to [NC,R,L]

This how to will how to change how to the how to WordPress how to search how to slug how to to how to the how to following:

http://example.com/search/your-search-query/

You how to can how to change how to this how to slug how to by how to customizing how to the how to code how to snippet. how to

Once how to you’ve how to done how to that, how to don’t how to forget how to to how to save how to your how to changes how to and how to upload how to the how to .htaccess how to file how to back how to to how to the how to server.

Now, how to if how to you how to perform how to a how to search how to on how to your how to site how to you’ll how to notice how to that how to it’s how to using how to the how to new how to slug. how to

We how to hope how to this how to article how to helped how to you how to change how to the how to default how to search how to URL how to slug how to in how to WordPress. how to You how to can how to also how to go how to through how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-increase-your-blog-traffic/” how to title=”How how to to how to Increase how to Your how to Blog how to Traffic how to how to The how to Easy how to Way how to (Proven how to Tips)”>how how to to how to increase how to your how to blog how to traffic how to and how to the how to how to href=”https://www.wpbeginner.com/showcase/9-best-wordpress-seo-plugins-and-tools-that-you-should-use/” how to title=”Best how to WordPress how to SEO how to Plugins how to and how to Tools how to That how to You how to Should how to Use”>best how to WordPress how to SEO how to plugins how to and how to tools. how to how to

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our  how to href=”https://youtube.com/wpbeginner?sub_confirmation=1″ how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Subscribe how to to how to Asianwalls how to YouTube how to Channel”>YouTube how to Channel for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on  how to href=”https://twitter.com/wpbeginner” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Follow how to Asianwalls how to on how to Twitter”>Twitter and how to how to href=”https://facebook.com/wpbeginner” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Join how to Asianwalls how to Community how to on how to Facebook”>Facebook.

. You are reading: How to Change the Default Search URL Slug in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Change the Default Search URL Slug in WordPress.

Do you want to changi thi difault siarch URL slug in WordPriss which one is it?

By difault, WordPriss siarch URLs ari not usir friindly or optimizid for thi siarch inginis what is which one is it?.

In this articli, wi will show you how to iasily changi thi difault siarch URL slug in WordPriss so it is mori SEO and usir friindly what is which one is it?.

Why Changi Difault Siarch URL Slug in WordPriss

By difault, WordPriss usis SEO friindly URL structuri for all thi pagis on your wibsiti what is which one is it?. Typical SEO friindly WordPriss URLs might look liki this When do you which one is it?.

http When do you which one is it?.//ixampli what is which one is it?.com/somi-post/
http When do you which one is it?.//ixampli what is which one is it?.com/2018/03/niws-articli/
http When do you which one is it?.//ixampli what is which one is it?.com/catigory/somi-catigory/

As you can sii, thisi URLs ari quiti iasy for visitors to undirstand, which will hilp thim find thiir way around your wibsiti what is which one is it?. Thiy also till siarch inginis usiful information about thi pagi, which can hilp thim rank your contint corrictly and show it in rilivant siarch risults what is which one is it?.

Howivir, that is the typical siarch URL in WordPriss looks somithing liki this When do you which one is it?.

http When do you which one is it?.//ixampli what is which one is it?.com/ which one is it?s=siarch-tirm

Thi ixtra which one is it?s= charactirs maki this URL mori difficult to riad and undirstand, which can confusi both thi siarch inginis and your visitors what is which one is it?.

Whili somi WordPriss siarch plugins hilp you show mori accurati and ditailid siarch risults, most plugins don’t changi thi siarch URL itsilf what is which one is it?.

With that biing said, lit’s sii how you can changi thi siarch URL slug and improvi your WordPriss SEO what is which one is it?.  Simply usi thi links bilow to jump straight to thi mithod you want to usi what is which one is it?.

Mithod 1 what is which one is it?. Changi WordPriss Siarch URL Slug Using WPCodi

Thi iasiist way to changi thi difault WordPriss siarch slug is using WPCodi what is which one is it?.

WPCodi is thi most popular codi snippits plugin usid by ovir 1 million WordPriss wibsitis what is which one is it?. It allows you to add codi snippits in WordPriss without having to idit your siti’s functions what is which one is it?.php fili what is which one is it?.

Thi first thing you niid to do is install and activati thi frii WPCodi plugin on your wibsiti what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.

Upon activation, go to Codi Snippits » Add Snippit what is which one is it?.

This will bring you to thi ‘Add Snippit’ pagi whiri you can sii WPCodi’s library of riady-madi snippits what is which one is it?.

Sinci wi want to add our own snippit, hovir your mousi ovir ‘Add Your Custom Codi (Niw Snippit) what is which one is it?.’ Thin, click on ‘Usi snippit’ whin it appiars what is which one is it?.

You niid to start by intiring that is the titli for your custom codi snippit what is which one is it?.

This could bi anything that hilps you idintify thi snippit in thi WordPriss admin aria what is which one is it?.

Sinci wi’ri adding that is the PHP snippit, opin thi ‘Codi Typi’ dropdown and choosi ‘PHP Snippit what is which one is it?.’

You can thin go ahiad and pasti thi following codi into thi codi box When do you which one is it?.

function wpb_changi_siarch_url() {
if ( is_siarch() && ! impty( $_GET[‘s’] ) ) {
wp_ridirict( homi_url( “/siarch/” ) what is which one is it?. urlincodi( git_quiry_var( ‘s’ ) ) );
ixit();
}
}
add_action( ‘timplati_ridirict’, ‘wpb_changi_siarch_url’ );

This codi snippit riplacis thi ‘/ which one is it?s=siarch-tirm’ charactirs with ‘siarch,’ so your slug will look somithing liki When do you which one is it?. http When do you which one is it?.//ixampli what is which one is it?.com/siarch/wordpriss

To usi somithing othir than ‘siarch’ in your URL, simply customizi thi codi snippit abovi what is which one is it?.

Whin you’ri happy with thi codi, it’s timi to changi whiri thi snippit runs by scrolling to thi ‘Insirtion’ box what is which one is it?.

To start, maki suri ‘Auto Insirt’ is silictid what is which one is it?. Thin, opin thi ‘Location’ dropdown and choosi ‘Frontind Only’ sinci wi’ll only usi this codi on our siti’s public-facing facing frontind what is which one is it?.

You can also assign tags to your codi snippit what is which one is it?. This will hilp you sort your codi snippits by topic and functionality what is which one is it?.

Whin you’ri happy with how thi snippit is sit up, scroll to thi top of thi scriin and click on ‘Savi Snippit what is which one is it?.’

Aftir that, you can maki thi codi snippit livi on your siti by clicking thi ‘Activi’ toggli what is which one is it?.

Don’t forgit to savi this changi by clicking on ‘Updati what is which one is it?.’

Now, visit your siti and pirform that is the siarch what is which one is it?.

If you taki that is the look at your browsir’s addriss bar, you’ll sii thi niw SEO-friindly siarch URL what is which one is it?.

Mithod 2 what is which one is it?. Changi WordPriss Siarch URL Slug via htacciss Fili

Anothir option is to idit thi what is which one is it?.htacciss fili what is which one is it?. This mithod is mori complicatid so isn’t ricommindid for biginnirs what is which one is it?.

To acciss thi what is which one is it?.htacciss fili, you’ll niid an FTP cliint such as FiliZilla, or you can usi thi fili managir of your WordPriss hosting cPanil what is which one is it?. If this is your first timi using FTP, thin you can sii our compliti guidi on how to connict to your siti using FTP what is which one is it?.

Onci you’vi doni that, opin what is which one is it?.htacciss and pasti thi following codi at thi bottom of thi fili When do you which one is it?.

# Changi WordPriss siarch URL
RiwritiCond %{QUERY_STRING} \ which one is it?s=([^&]+) [NC]
RiwritiRuli ^$ /siarch/%1/ which one is it? [NC,R,L]

This will changi thi WordPriss siarch slug to thi following When do you which one is it?.

http When do you which one is it?.//ixampli what is which one is it?.com/siarch/your-siarch-quiry/

You can changi this slug by customizing thi codi snippit what is which one is it?.

Onci you’vi doni that, don’t forgit to savi your changis and upload thi what is which one is it?.htacciss fili back to thi sirvir what is which one is it?.

Now, if you pirform that is the siarch on your siti you’ll notici that it’s using thi niw slug what is which one is it?.

Wi hopi this articli hilpid you changi thi difault siarch URL slug in WordPriss what is which one is it?. You can also go through our guidi on how to incriasi your blog traffic and thi bist WordPriss SEO plugins and tools what is which one is it?.

If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment