Conflict with wp_homeurl, wp_siteurl and admin interface settings

I’m starting wordpress development, and learning the platform.
Now I’m stuck with a strange issue.
I have created a virtual host configuration that works as expected.
I’m using xip.io for dns resolution, that also works as expected I can access wordpress application from other devices.

The thing that puzzles me is that if I define WP_HOMEURL and WP_SITEURL variables to the same values that are set via admin->options -> general settings the whole thing breaks. Nothing works anymore, I have to go directly to the database to reset site_url field.

Read More

The virtual host file

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example_dot_com
    DocumentRoot "C:/server/wp/wordpress"
    ServerName theme.local
    ServerAlias local.191.161.3.101.xip.io
    ErrorLog "logs/test1.com-error.log"
    CustomLog "logs/test1.example.com-access.log" common
</VirtualHost>

Settings in the admin UI

WordPress Address (URL) :  http://local.191.161.3.101.xip.io
Site Address (URL)  :  http://local.191.161.3.101.xip.io

I thought that those values are the same, and that it makes no difference how you define them (wp-config.php or via admin interface)?

Obviusly I’m doing something wrong, but I can’t see what is it.

Related posts

1 comment

  1. The constants you need to define are WP_HOME, not WP_HOMEURL, and WP_SITEURL, and you need to complete address. Your addresses are missing the schemehttp://

    define( 'WP_SITEURL', 'http://local.192.168.3.101.xip.io'); 
    define( 'WP_HOME', 'http://local.192.168.3.101.xip.io' ); 
    

    Without the scheme, WordPress treats those URIs like relative addresses. You can see that in the address bar if you watch what is happening.

Comments are closed.