Support » Networking WordPress » Searching redirects to the home page

  • Hi all,

    I ve seen similar topics but didn’t help me or I just didn’t understand.

    So I have a multisite installation (using subdomains), including two simple wordpress installation and one buddypress installation.

    In the buddypress installation after searching for a term using the search field I am redirected to the homepage. I tested the other two wordpress sites and they work properly.

    Please any help, would be much appreciated.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Homepage? http://www.domain.tld or sub.domain.tld? I am gonna take a shot in the dark that what you may be seeing is because of your theme (Hint: knowing what theme you are using so someone could reproduce your result would be helpful).

    It is or was common to write the seachform.php in a theme using

    action="<?php echo $_SERVER['PHP_SELF']; ?>

    In multisite this may return you to the http://www.domain.tld/index.php – which would be fine in a single WP install of course.

    The fix, if you have that code indeed in your theme, is to change it to

    action="<?php bloginfo('home'); ?>

    Hi and thank you very much for your response!

    The problem is occurred only in one subdomain. So searching it redirects in sub.domain.tld

    Furthermore this ain’t a theme issue as it is occurred in any theme (default etc).

    The theme’ searchform.php file is like this:

    <?php do_action( 'bp_before_blog_search_form' ); ?>
    <div id="top-search-container">
    <div id="adv-search-link"><a href="<?php echo home_url(); ?>/searching"><img src="<?php echo get_template_directory_uri(); ?>/images/adv-search.png" alt="Advanced Search" /></a></div>
    <form method="get" id="searchform" action="<?php echo home_url(); ?>/">
    <div id="searchform-child">
    	<input type="text" title="<?php echo of_get_option('t-8', 'Search' ); ?>" value="<?php the_search_query(); ?>" name="s" id="s" class="hoverText hoverTextActive" />
    	<input type="submit" id="searchsubmit" value=" " />
    	<?php do_action( 'bp_blog_search_form' ); ?>
    <?php do_action( 'bp_after_blog_search_form' ); ?>

    I just noticed that if I change the permalinks from post name to default, searching works properly.

    But I need pretty permalinks not the default.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Searching redirects to the home page’ is closed to new replies.