[resolved] WordPress URL Setting (5 posts)

  1. Shaun
    Posted 4 years ago #

    I use wordpress a lot for work and we always tend to build the site/theme/etc on a dev server and move it to the production server upon completion.

    Having the wp blog url stored in the db leaves most of the site links broken until it is updated once the site is moved over. While not incapacitating it is slightly annoying. Recently I had to deal with trying to set up WP on a SSL host (which didnt go well at all), but the url seemed to never work (could have been a server setting redirecting).

    What I would propose is storing this variable in the wp-config.php file instead, it seems like it would be easier to update here even if you could not log into the wp-admin (yes I know you can manually do it via the db).

  2. You can.

    define('WP_SITEURL', 'http://example.com/wordpress');
    define('WP_HOME', 'http://example.com/wordpress');

    Most of the time, though, you build the site out on it's own URL and then use the tricks in moving WordPress to solve that problem. Not like WP will run without the DB anyway ;)

  3. Shaun
    Posted 4 years ago #

    when WP pulls those values from the db is is just using the php define function to set them anyway?

    If thats the case I will always add those lines to my wp-config, however, when wordpress sets them from the db is it going to give errors? because im assuming it isnt using

    @define('WP_SITEURL', 'http://example.com/wordpress');

    note the "@"

  4. No, the config file overrides the database. You should be fine, and I've never needed to preface it with the @ symbol.

  5. Shaun
    Posted 4 years ago #

    wow thats awesome!! thank you!! just set it up

Topic Closed

This topic has been closed to new replies.

About this Topic