WordPress.org

Ready to get started?Download WordPress

Forums

Search Results page not found on localhost (2 posts)

  1. sam1vp
    Member
    Posted 1 year ago #

    Hi all, I'm trying to get my local machine to render my custom theme's search.php template, but when I post my site's search form, I'm redirected to "localhost/search/fooquery" and see a standard apache 'URL not found' error. I'm relatively new to wordpress and stumped, would appreciate some help!

    A few details:
    - I'm not having the same problem on the production server.
    - On both production and localhost I have the wordpress app in a subfolder, called wordpress, but serve up the site from root. In the wp_options table, my site_url is "http://localhost/wordpress" and my home is "http://localhost".
    - I've turned off custom permalinks on my local machine, still having the issue

    Here's /Library/Webserver/Documents/index.php


    <?php
    /**
    * Front to the WordPress application. This file doesn't do anything, but loads
    * wp-blog-header.php which does and tells WordPress to load the theme.
    *
    * @package WordPress
    */

    /**
    * Tells WordPress to load the WordPress theme and output it.
    *
    * @var bool
    */
    define('WP_USE_THEMES', true);

    /** Loads the WordPress Environment and Template */
    require('./wordpress/wp-blog-header.php');

    And here's /Library/WebServer/Documents/.htaccess:

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

    Any suggestions?

  2. CFS
    Member
    Posted 1 year ago #

    Hello sam1vp,

    I saw there were no replies for 5 days so I thought I would try and reply.

    Are you using any custom search plugins or SEO plugins which modify the search URL? If so, you may want to check the settings page for those plugins.

    When moving a website between two domains such as your livesite.com and your localhost, there are multiple values in the database which need to be updated.

    Install the WP Migrate DB plugin on the live website and export the database. WP Migrate DB can properly do a find and replace on URLs and file paths, etc. http://wordpress.org/extend/plugins/wp-migrate-db/

    Another good option is this PHP script which does the same thing as the plugin: http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    Then import the database to your localhost. If everything else is the same between your live website and localhost (same files, same theme, etc), the search page should work.

    Please post back here if that worked out for you!

Topic Closed

This topic has been closed to new replies.

About this Topic