[wp-hackers] Site Address during development

Bjorn Wijers burobjorn at gmail.com
Fri Sep 3 13:09:43 UTC 2010


>> It seems so easy and I'm probably not the first proposing this. So why
>> hasn't this been done yet? Am I missing something?
>>
>>
> Here is my take on it.
>
> What is being proposed is to enforce the calculation of the absolute URL on
> every single WordPress installation feed (and any other way the content may
> be accessed out of context of the web), to solve a problem that manifests
> itself *at the point someone moves a site to a different domain*.
>
> This 'solution' is 'fixing' a problem that doesn't exist.

I disagree.

Inserting data into a database with absolute urls seems a bad idea, for 
at least two reasons:

- Hard to change
- Repeats (unnecessary) data all over the database

Especially when there are already constants implemented used to resolve 
relative urls to absolute urls (WP_SITEURL and WP_HOME). These constants 
imply the use of a resolver used to resolve relative urls to absolute 
ones. Why write the absolute url to the database then?

Btw these constants did not work with WordPress Mu (not sure about the 
current situation with this on multisite) and thus makes DTAP 
(Development, Test, Acceptance, Production) style development annoying 
and unnecessary hard.


> The problem that does need fixing is "how to change all the absolute URLs
> when I move my site."
>
> So, how about approaching it from the other end?
>
> Here is my proposal: A "development mode" plugin, that:
>
> 1) Has filters to prevent the URLs from being saved as absolute during
> development and testing. Code to do this has already been kindly provided on
> this thread.
>
> 2) Has filters to 'fix' the non-absolute URLs dynamically for feeds and
> whatever else needs them during development.
>
> 3) Has a 'Go Live' button to click, which changes all the non-absolute URLs
> to absolute ones when you deploy to live. Then removes all it's filters.
>
> This would solve the real problem, with no overhead for *any* WordPress site
> that isn't in development.
>
> This could also be the basis for a number of other things that need tweaking
> during development, debug mode, non-compressed css/js, no-index settings,
> etc.

I like your idea of having a development mode plugin which takes care of 
most of the nity gritty differences between development and a live site, 
but absolute urls are/were a bad idea from the start and should be fixed 
instead made tolerable ;)

grtz
BjornW


More information about the wp-hackers mailing list