• I have sites with hundreds of images stored at wp-content/images

    On the live server, <img src=”/wp-content/images/..” works fine.

    On the development (localhost) server, I have to use <img src=”sitename/wp-content/images..”

    I don’t really want to have a different directory structure online; is there a way of avoiding having to replace every reference for every update?

    ‘WordPress URL’ and ‘Site URL’ don’t seem to be the answer.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    You can do a search and replace with this plugin: http://wordpress.org/extend/plugins/search-regex/

    Thread Starter mystifier

    (@mystifier)

    Thanks keesiemeijer, but this is effectively what I am doing now but would like to avoid.

    Aside from the baseurl, I would like to have a database that was otherwise the same both on and off line with relatively addressed images and links.

    Moderator keesiemeijer

    (@keesiemeijer)

    Thread Starter mystifier

    (@mystifier)

    Thanks again keesiemeijer, but this still doesn’t give me what I want; this cleans permalinks from absolute to root relative (which they would be far better being anyway).

    I have lots of images in hundreds of posts in the database and I would like them to be the same on both localhost and live sites so that I don’t have to change hundreds of records every single time I upload/download.

    The fundamental problem is that the root of the site is http://www.sitename.com or localhost/sitename (which is a level off webserver root).

    WordPress just doesn’t seem capable of handling it. I don’t know if I can do something such as an Alias in httpd.conf.

    Moderator keesiemeijer

    (@keesiemeijer)

    I don’t know if this is a solution on your localhost. In my computers host file I have this :

    127.0.0.1 localhost
    127.0.0.1 sitename.dev

    now when I browse to my localhost site I go to http://sitename.dev

    This is how I achieved this virtual host: http://wordpress.org/support/topic/wordpress-3-network-multisite-on-a-local-development-site?replies=49

    Thread Starter mystifier

    (@mystifier)

    Thanks again keesiemeijer.

    I think you have confirmed that there is nothing within WordPress to handle this so I need to look at an external fix.

    It is pretty normal to have several development websites under localhost so it would be a nice future feature to be able to accommodate relative path images.

    Moderator keesiemeijer

    (@keesiemeijer)

    Well, with virtual hosts you can have multiple development websites with normal urls. Can’t you use the relative url fix from a few posts back? It is a bit of a hassle to set up multiple virtual hosts but once it’s working it is so easy to set up a new development website.

    Thread Starter mystifier

    (@mystifier)

    Thanks keesiemeijer.

    I will try for an httpd.conf solution because there are numerous websites running under localhost and I like to keep code hacks to a minimum.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Relative Images’ is closed to new replies.