• Resolved sorknes

    (@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$ http://work.leonorge.no/leonorge/new_site/wp-login.php [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]
    </IfModule>

    # 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)
  • Try just using <?php get_search_form(); ?>.

    Thread Starter sorknes

    (@sorknes)

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

    From a functionality pov, http://work.leonorge.no/leonorge/new_site/?s=and&submit=Search seems to work OK (although the search template file needs attention).

    Thread Starter sorknes

    (@sorknes)

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

    PS.
    The search template isn’t done yet ;-P

    Knut

    Thread Starter sorknes

    (@sorknes)

    Found the problem!

    There was an error in my searchform.php:

    <form action="/" method="get">
        <fieldset>
            <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;" />
        </fieldset>
    </form>

    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>
        </div>
        </form>';
    
        return $form;
    }
    
    add_filter( 'get_search_form', 'my_search_form' );

    Problem solved!

    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.