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.

The virtual host file

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

Settings in the admin UI

WordPress Address (URL) :  http://local.
Site Address (URL)  :  http://local.

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.

  • What do your wp-config.php lines look like? – s_ha_dum May 30 '13 at 15:08
  • ` define( 'WP_SITEURL', 'local.'); define( 'WP_HOMEURL', 'local.' ); ` – iki_xx May 30 '13 at 16:26
  • edit: somehow back tick don't work for code formating. – iki_xx May 30 '13 at 16:35
  • You did something wrong. Backticks do work in the comments. – s_ha_dum May 30 '13 at 16:36

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 scheme-- http://

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

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

  • Thank you, it appears that all I needed was a fresh pair of eyes. Even when I was posting the code here I didn't notice that I'm missing http:// scheme. Also the variable name.... – iki_xx May 30 '13 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.