http://localhost on a live Wordpress site

Soldato
Joined
18 Oct 2002
Posts
14,915
This is either genius or the height of folly and I need some help understanding which.

I work for a design agency and we often outsource web development. I'm fairly familiar with Wordpress and I can hack a theme about if I need to but I'm certainly no php expert or anything like that.

One of the biggest pains with Wordpress is working on both a staging and a production server because every time you update or replace the database between the two you have to then change all of the site URLs.

We recently had a site built for us and the developer got around this by setting the site url in the database to http://localhost and then controlling the actual site URL by adding a couple of lines to the wp-config file.

This seems to me to be quite an elegant solution but I just wonder if there are any security issues with this method?

Can anyone shed some light on why this would or wouldn't be a good idea?

Cheers.
 
I dont really see it as a big problem having to update urls between test and deployment. You're going to make a backup of the database in the process anyway, it takes an extra 30 seconds or so to open the backup file and do a find+replace on the url.
 
Thanks for the replies guys.

So while it could be easier to just use an import/export plugin or URL replacement plugin, there's nothing fundamentally wrong with using the localhost method?
 
Thanks for the replies guys.

So while it could be easier to just use an import/export plugin or URL replacement plugin, there's nothing fundamentally wrong with using the localhost method?

Depends how it's done. If he's using some code in the wp-config which goes and updates the fields in the database, there probably wont be any issues.
If he's using code which just sets the values and ignores the database, it still probably wont cause any issues but you may find at some point that some plugin author has decided it's a good idea to ignore the wordpress standards and go directly to the database to get the url for some reason and breaks the site.
 
Back
Top Bottom