WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Not all url paths generated correctly under a mod_proxy configuration (2 posts)

  1. aproimage
    Member
    Posted 2 years ago #

    Hi all,

    I will do my best to try and explain this one but it was hard enough coming up with the title.

    Basically one of my clients already has an established website (Lets call it http://clientsite.com). I have built them a secondary WordPress based site for an upcoming promotion. This promotional site is hosted externally, yet they were determined that it should be accessed through a subdirectory of their existing domain (http://clientsite.com/thepromotion).

    They have used a mod_proxy at their end to point their subdirectory to the IP of the hosting for the promotional site, and for the main part I have got everything up and running. There are just a few instances (mainly with back end functions) that result in 404 errors because the subdirectory gets omitted from the url, for example if I try to use the checkboxes to move multiple posts to trash the url will begin http://clientsite.com/wp-admin/edit.php?..... instead of http://clientsite/thepromotion/wp-admin/edit.php.....

    This happens in a few places, and although the front end seems ok I'd rather get to the bottom of this, is there a way to make sure that the subdirectory (/thepromotion/) is always used in url's to avoid the 404 errors?

    Another issue that may be related, is that if I refresh the permalinks by visiting the permalinks page, all but the sites home page on the front end, ends up with 500 Internal server errors.

    I'm thinking that I need to reaffirm the sites base url either within WordPress somewhere or in .htaccess any help is much appreciated.

    Rob

  2. aproimage
    Member
    Posted 2 years ago #

    Just to follow up on this, I revisited the following forum post

    http://wordpress.org/support/topic/wordpress-strips-subdirectory-at-some-wp-admin-pages-with-and-reverse-proxy?replies=11

    and added the code provided by talkstar to my wp-config.php after adapting it to my needs, for the main part this does the trick.

    $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
    $_SERVER['REQUEST_URI'] = '/thepromotion' . $_SERVER['REQUEST_URI'];
    $_SERVER['SCRIPT_NAME'] = '/thepromotion' . $_SERVER['SCRIPT_NAME'];
    $_SERVER['PHP_SELF'] = '/thepromotion' . $_SERVER['PHP_SELF'];
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
    define('WP_HOME', 'http://clientsite.com/thepromotion');
    define('WP_SITEURL', 'http://clientsite.com/thepromotion');

Topic Closed

This topic has been closed to new replies.

About this Topic