When submitting or previewing forms, I get HTTP 404 errors because the url that is being requested does not reflect the $base_url of the setting.php file.

For example, in my settings.php file: "site\www.example.com\settings.php" I set the base url as:
$base_url = 'http://www.example.com/site';

The form action element looks like:
<form action="/index.php?....>

And this url resolves to http://www.example.com/index.php?...

instead of what I want - http://www.example.com/site/index.php?...

Also, I am using Windows Server 2003.

Any ideas on how to correct this?

Comments

dataknack’s picture

This is what I did as a workaround. I wonder if anyone else has run into this problem.

I overrode the the theme_form funtion from form.inc. Here is what I added to my template.php:

function my_theme_form($element) {

  $path = rtrim(base_path(),'/');  // added $path, since this was was missing 

  $action = $element['#action'] ? 'action="' . check_url($path . $element['#action']) . '" ' : '';

  return '<form '. $action . ' method="'. $element['#method'] .'" '. 'id="'. $element['#id'] .'"'.  drupal_attributes($element['#attributes']) .">\n<div>". $element['#children'] ."\n</div></form>\n";

}
marc.zonzon’s picture

Same issue on the node/63947.

frasketi’s picture

I am having the same issue in 5.5, applying the fix here solves my page preview and submit problems, but now when I try to add/remove modules or search, those submits fail. I can see in the url on the module safe and search submit the site portion is repeated. Such as http://www.example.com/site/site/search/node/test.

Any help would be great. Thanks.

inforeto’s picture

subscribing