• Resolved awsm1th

    (@awsm1th)


    Is it possible to setup two installs of wordpress that hit the same database to show the same blog?

    Specifically, what I’m trying to do is get setup so that the main access to the site is at:
    http://www.example.com/my-blog/

    But I also have the ability to use:
    https://secure.example.com/my-blog/

    to do all the admin stuff on the site. In this way, I wouldn’t have to worry about doing admin stuff when I’m traveling and using an untrusted connection.

    It looks like I could just do the two sepearte installs and use the same config, but I’ve seen some other notes in this forum that suggest that wordpress might choke if the domain changes.

    Any ideas? or has anyone done anything like this before?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The blog’s and WP install’s URL are stored in the database (see admin > Options > General) – so I don’t think it will work.

    Thread Starter awsm1th

    (@awsm1th)

    I’m giving this a try on a test blog and the issue that moshu pointed out was causing an issue. I could get to the blog and any individual page with the secure https://secure.example.com/ link, but every time I tried to navigate to another location it would roll back to the regular http://www.example.com/ domain.

    Just to see what would happen I changed the Admin -> Options -> General -> WordPress address (URI) value to a relative link (“/test-blog”) instead of a full URI (“http://www.example.com/test-blog”) and everything seems to work.

    It’s still an open question though. Does someone with more knowledge about the inner workings of WordPress know if this is going to come back to bite me?

    Thread Starter awsm1th

    (@awsm1th)

    Think I’ve got a way to do this based on the notes from this page.

    Here’s a line by line of what I did.I have two domains setup with the following docRoots:

    http://www.example.com/
    /home/me/public_html

    https://secure.example.com/
    /home/me/secure_html

    wordpress is installed in:
    /home/me/public_html/wordpress

    First step is to create a symbolic link to wordpress inside the scure_html with the command: “ln -s /home/me/secure_html/wordpress /home/me/public_html/wordpress”

    With the symbolic link you only have to make changes to files, templates, whatever in one place and they will appear on both the regular and secure versions of you blog.

    Next step is to edit the “wp_config.php” file. The way I did it was to add the following lines just below the “require_once(ABSPATH.’wp-settings.php’);” line.

    //START SECURE CONFIG HACK
    wp_cache_set(“siteurl_secure”, “https://secure.example.com/wordpress/”, “options”);

    wp_cache_set(“home”, $_SERVER[“HTTPS”]?”https://secure.example.com/wordpress/” : “http://www.example.com/blog/”, “options”);

    wp_cache_set(“siteurl”, get_settings(“home”), “options”);
    // END SECURE CONFIG HACK

    This tells word press that if you are accessing it from a secure page to stay with a secure page.

    For the edit to the “wp-login.php” file, I did it a slightly different way than the “noctis.de” example. The first thing in wp-login.php is:

    require( dirname(__FILE__) . ‘/wp-config.php’ );

    Directly below this I added:

    // START
    if( !$_SERVER[‘HTTPS’]) {
    header(“Location: ” . get_settings(‘siteurl_secure’) . “wp-login.php”);
    }
    // END

    This way, whenever the login page is called a check is made to ensure that you are on the secure domin. If not, you are redirected there automatically.

    Anyways, after just a little testing this seems to be working for me. Good luck, and hopefully this type of functionality will get added into the WordPress core soon.

    haristv

    (@haristv)

    Admin-SSL supports Private and Shared SSL. You can have the above setup in a few clicks.

    http://haris.tv/2007/04/24/admin-ssl-new-wordpress-plugin/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using two domains for secure editing?’ is closed to new replies.