WordPress.org

Ready to get started?Download WordPress

Forums

/search/keyword instead of /?s=keyword (3 posts)

  1. bowa
    Member
    Posted 7 years ago #

    if i surf to my site/search/keyword i get the searchresults for 'keyword' so that works perfectly

    but when i use the searchbox on my WP site then it also shows me the searchresults page but with the url site/?s=keyword

    and that doesnt look so nice, also in Google analytics is nice to be able to look at all the keywords users searched at using the content drilldown option for all 'pages' under /search/

    so i wonder if its possible to easily change the search option to use the nice url mapping instead of the querystring version

  2. bowa
    Member
    Posted 7 years ago #

    i created a dummy search page that takes the post variable and creates the right link, now i get the nice /search/keyword urls in my google analytics

    <?php
    $searchterm = $_POST["s"];
    $searchurl = "/search/";
    $redirecturl = $searchurl . $searchterm;
    header("Location: " . $redirecturl);
    ?>

  3. vlp
    Member
    Posted 6 years ago #

    Hi, could you please specify where do you place this code?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.