Problem: I have set up several WordPress sites on a Deluxe Hosting account on Godaddy where I set up a domain to point to a subfolder on the hosting server.
Ex: http://www.mydomain.com points to http://www.accountdomain.com/mydomain
Now when I put WordPress in /mydomain, I log into http://www.mydomain.com/wp-login.php, then try to save some settings, and the page redirects to the login page at http://www.mydomain.com/mydomain/wp-login.php?<querystring> which then wants to redirect to http://www.mydomain.com/mydomain/whateverpageIwason.php instead of just http://www.mydomain.com/whateverpageIwason.php.
Get all that?
I tracked down the culprit to the wp_referer_field function defined in /wp-includes/functions.php. The server is reporting like the main URL is http://www.accountdomain.com instead of http://www.mydomain.com.
So here comes the dirty hack in blue below.
function wp_referer_field( $echo = true) {
$ref = attribute_escape( $_SERVER['REQUEST_URI'] );
$ref = str_replace("/mydomain", "", $ref);
$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
if ( $echo )
echo $referer_field;
return $referer_field;
}
If the string “/mydomain” is found in the referral string, I strip it out.
I am aware of a way to fix this by editing the .htaccess file, but I don’t think Godaddy permits access to it.
I’m open to ideas. I’m using WordPress 2.7
Update 8/24/2009:
It’s not a bug… it’s a feature.
Don’t go and try to change the code like I did, folks.
The fix is very simple: On the General settings page, leave the WordPress address (URL) field as “http://www.mydomain.com/mydomain” and change Blog address (URL) field to “http://www.mydomain.com”.