Support » Fixing WordPress » When search I get forbidden 403 error mesg.

  • Resolved sorknes


    I’ve added <?php get_search_form(”); ?> to my blog, and when I search my search result-page gives me:

    Forbidden 403
    You don’t have permission to access / on this server.

    My .htaccess file is as follow:
    RewriteRule ^login$ [NC,L]

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /leonorge/new_site/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /leonorge/new_site/index.php [L]

    # END WordPress

    My permalink is set to display month and day.

    All my other sub-pages work as they should. Only my search result page is giving me a headache.

    Please help 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi


    Forum Moderator

    Try just using <?php get_search_form(); ?>.

    Thanks for your suggestion esmi, but same error occurs. Any other suggestions?



    Forum Moderator

    From a functionality pov, seems to work OK (although the search template file needs attention).

    This is so strange. Haven’t had this problem before. Tried to google it, but couldn’t find any thread about this particular problem.

    The search template isn’t done yet ;-P


    Found the problem!

    There was an error in my searchform.php:

    <form action="/" method="get">
            <input type="text" name="s" id="search" value="<?php the_search_query(); ?>" />
            <input type="image" alt="Search" src="<?php bloginfo( 'template_url' ); ?>/images/search.png" style="background-color: black;" />

    Used this function instead:

    function my_search_form( $form ) {
    	$form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
        <div class="searchform">
        	<label class="screen-reader-text" for="s">' . __('') . '</label>
        	<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="Start typing here..." />
        	<input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" title="Search my site" />
        	<div class="clear"></div>
        return $form;
    add_filter( 'get_search_form', 'my_search_form' );

    Problem solved!



    Forum Moderator

    Does your theme include a searchform.php template file?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘When search I get forbidden 403 error mesg.’ is closed to new replies.