• 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:
    https://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

Viewing 5 replies - 1 through 5 (of 5 total)
  • You can easily change the paths. See either of the videos in the following post for step-by-step directions.

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

    Thread Starter dmattock

    (@dmattock)

    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 https://blahblah.. path
    thanks again

    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.

    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?

    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):

    https://www.ads-software.com/extend/plugins/search-and-replace/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Why cant I use relative paths to my images ?’ is closed to new replies.