Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The search on my wordpress site is resulting in a 404. When I hit the search button it tries to open a php file in a path that does not exist wordpress/wordpress/index.php. I dont know how that was configured or where to reset the search button action code.

I assumed that installing "search everything plugin" will solve my search problems, it did. The test does a wonderful search. But I need to figure out how to fix the search button issue.

I have just started work on wordpress and dont know php.

Edit : I just did a "view source" for my home page and found

<form id="searchform" class="searchform" method="get" action="http://localhost/wordpress/wordpress/index.php">

I also did a

sudo grep -r "searchForm" .

To find the source of all my pain,

./wp-content/themes/graphene/searchform.php:<form id="searchform" class="searchform" method="get" action="<?php echo get_home_url(), $_SERVER['PHP_SELF']; ?>">

Seems like the url is getting its value from PHP-SELF

So I search where PHP-SELF is getting its value from

sudo grep --exclude-dir=.svn -r "SERVER\['PHP_SELF'\] = " .
./wp-includes/load.php:     $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
./wp-login.php:     $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );

Now, seems like REQUEST_URI is used to initialize PHP_SELF OR Its PATH_INFO and PHP_SELF

As I dig further it gets more complex. My question is, What is expected to be the value of PHP_SELF.

sudo grep --exclude-dir=.svn -r "SERVER\['REQUEST_URI'\] = " .
./wp-includes/load.php:         $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
./wp-includes/load.php:         $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
./wp-includes/load.php:                 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
./wp-includes/load.php:                 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
./wp-admin/link-manager.php:    $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
./wp-admin/upload.php:  $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
./wp-admin/upload.php:  $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']);
./wp-admin/upload.php:  $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
./wp-admin/upload.php:  $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
./wp-admin/upload.php:  $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
./wp-admin/upload.php:  $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
./wp-admin/plugins.php:$_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
./wp-admin/edit-tags.php:<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
./wp-admin/network/themes.php:$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] );
./wp-admin/network/site-users.php:$_SERVER['REQUEST_URI'] = remove_query_arg( 'update', $_SERVER['REQUEST_URI'] );
./wp-admin/network/site-themes.php:$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] );
./wp-admin/includes/class-wp-plugins-list-table.php:            $_SERVER['REQUEST_URI'] = add_query_arg('s', stripslashes($_REQUEST['s']) );
./wp-admin/edit.php:$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI'] );
./wp-content/plugins/w3-total-cache/lib/W3/PgCacheFlush.php:        $_SERVER['REQUEST_URI'] = $url;
./wp-content/plugins/w3-total-cache/lib/W3/PgCacheFlush.php:        $_SERVER['REQUEST_URI'] = $request_uri;
share|improve this question
    
You may be looking for the wrong thing. $_SERVER['PHP_SELF'] is a system variable, which is used within Wordpress, not created by it. See php.net/manual/en/reserved.variables.php for more detail. –  John Gardeniers Jun 11 '12 at 2:22
    
I hardcoded action="localhost/wordpress"; and my search worked. So now the issue is narrowed down to the action value. Now my question is, shouldn't I be using macros instead of hardcode for the search "action" value ? –  Siddharth Jun 11 '12 at 4:12

1 Answer 1

Search Everything doesn't modify the search form, it only modifies the queries a search performs. You won't see any changes on the front end except within the contents of the search results.

share|improve this answer
    
But my search button still displays something crazy like wordpress/wordpress/index.php not found. I wonder why. –  Siddharth Jun 9 '12 at 16:45
    
@Siddharth, perhaps you should reword you question to tell us what you are seeing and what you expect to be seeing and please be more specific than "something crazy like...". –  John Gardeniers Jun 11 '12 at 1:49
    
@JohnGardeniers I have improved my question to be more specific and detailed. –  Siddharth Jun 11 '12 at 2:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.