WordPress.org

Ready to get started?Download WordPress

Forums

Why cant I use relative paths to my images ? (6 posts)

  1. dmattock
    Member
    Posted 5 years ago #

    Hi, Im ceating my first WP site, but so not to disrupt my current live site im building it in a sub directory and will then move it to my main directory when its finished, overwriting my current live site.

    Now my problem is WP is only letting me use absolute paths to my images on my pages eg:
    http://davidmattock.co.uk/temporary/wp-content/images/whatevr.jpg
    but I want a relative path like: /images/whatever.jpg

    because once this is finished and I move it to the root directory on my hosting server, it will take me AGES to go through and manually change the links to all my images !

    How can I use relative paths, or easily change it after than one by one ?
    At the moment its a non blog site and Im not and experienced coder
    Many Thanks

  2. figaro
    Member
    Posted 5 years ago #

    You can easily change the paths. See either of the videos in the following post for step-by-step directions.

    http://educhalk.org/blog/?p=82

  3. dmattock
    Member
    Posted 5 years ago #

    HI, thanks for the reply.
    I watched the video which is great thanks.. but I dont think it fixes paths to images on normal pages Ive created in WP does it ?

    why cant I just use relative paths in the first place ?, WP just doesn't allow it which is crazy ? I always need the full http://blahblah.. path
    thanks again

  4. figaro
    Member
    Posted 5 years ago #

    but I dont think it fixes paths to images on normal pages Ive created in WP does it ?

    It does if you search/replace the url...they are all in the db.

    I don't know the answer to your question about relative paths...maybe someone else can help with that.

  5. esmi
    Forum Moderator
    Posted 5 years ago #

    Think about it. Your blog might be in the root folder. But your theme's template files are at least 3 levels further down (wp-content/themes/theme_name). Or further if you use Child themes. So which relative path do you use?

    Now can you see why relative paths aren't so simple in WordPress?

  6. TransPersonal
    Member
    Posted 5 years ago #

    Not sure what the problem is because for my theme I can use relative paths. I guess it's because I have a images folder inside my theme's folder.

    it will take me AGES to go through and manually change the links to all my images !

    For this problem you can use this plugin (a lifesaver):

    http://wordpress.org/extend/plugins/search-and-replace/

Topic Closed

This topic has been closed to new replies.

About this Topic