Search Function Not Working in a WP install in a Subdirectory

This topic contains 5 replies, has 3 voices, and was last updated by  stars 9 years, 11 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #3925

    stars
    Free User
    Post count: 19

    I have a fresh install of WP with the core GeoDirectory plugin installed, the URL to this install is http://www.mysite.com/alias-to-subfolder/

    I load up the dummy info using the GeoDirectory backend and then try to search these dummie listings on the front end. What happens is that when I click search I get redirected to a URL that looks like this:

    www.mysite.com/alias-to-subfolder?geodir_search=1&stype=gd_place&........... ( this is not the full URL, just giving an example)

    If you notice the “/” between “/alias-to-subfolder” and the starting “?” is missing. If I manually add the “/” (“/alias-to-subfolder/?”) to the URL the search works fine.

    If I load geodirectory into my root install of WP (www.mysite.com) it works fine. It seems that the search function assumes that GeoDirectory will be running in a root folder and not a sub-diretory/alias. is there an easy fix for this or do I need to go in and change code to fix this?

    #3931

    Paolo
    Site Admin
    Post count: 31206

    Thanks for reporting this, I flagged it for a developer to look at.
    We’ll let you know asap.

    #3934

    stars
    Free User
    Post count: 19

    Thanks for the quick response.

    #3936

    stars
    Free User
    Post count: 19

    OK got a temporary fix.

    if you look in listing-filter-form.php @ line 8 you will see:

    <form class="listing_search" name="listing_search" action="<?php echo home_url();?>" method="get" >

    I changed this to:

    <form class="listing_search" name="listing_search" action="<?php echo home_url(), '/';?>" method="get" >

    and that fixed this issue in this case

    #3959

    Guust
    Moderator
    Post count: 29970

    Could you not just add a trailing slash to WP admin > Settings > general settings > WordPress Address (URL) ?
    Ops, you can’t: WP will remove the / on saving …

    #3992

    stars
    Free User
    Post count: 19

    Yeah that was my first thought but WP doesn’t like that. I have been testing my install with this change and so far its working fine.

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket