• Hi All!

    I am a big fan of relative paths and no matter what anyone says I will go on looking for cleaner, shorter code no matter what.

    When I build a WP site in development environment including local server on my computer or a beta folder under my future domain name, I use images in my posts by ftp upload in a folder called /images/ in the root directory of wordpress. This is so I do not type /wp-content/images, or anything else. It’s just what i have assumed as the shortest code I can write like /images/image1.jpg.

    How can i and why doesn’t WP recognize a path as follows “/images.filename.jpg” when the WP files are in a subfolder such as /beta/ or /test/? It keeps lookig for the images in the root directory of the path even when i have specified the WP folder is either /beta/ or /test/? None of my images would show unless I specify that temporary “beta” or “test” folder!

    My workaround has been to add an /images/ and /img/ folders in the root directory of the server during development that I then copy to the specific WP folder right before launch.

    None the less, it’s been bugging me and it makes it difficult to work on several sites at the same time, since they would share those /images/ and /img/ folders.

    Is there any way I can have either an htaccess redirect or WP setting where it would rewrite EVERY RELATIVE PATH WITHIN WP to the correct NEW path? I tried every suggestion for the htaccess that i could find and none have worked so far.

    There’s no way I will ever consider using the native media importer in WP – the sites I build often have thousands of products with multiple images each. I like to be organized.

    The bottom line is – I want to upload my images with FTP and stick to a relative path!

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • That isn’t really an explanation, jonradio! It’s just four paragraphs of ideological argument against using relative URLs followed by the admission that preventing the use of relative URLs may in fact have been a mistake:

    It has been suggested that if WordPress were to be able to do all of this over, we may have instead opted for relative URLs. This is true, and making adjustments to our current approach – or reconsidering it in its entirety – does remain a distinct possibility in the future.

    Other content management systems allow the use of relative paths. starflamedia asked how to do that in WordPress and there doesn’t seem to be an answer. I love WordPress, but forcing people to use absolute paths isn’t one of its good points.

    There’s an answer to the question asked above in the question asked here:

    https://stackoverflow.com/questions/17187437/relative-urls-in-wordpress

    However, as the accepted answer to that question makes clear, there may be problems with that solution (it’s just that nobody seems to have found them).

    Another solution here:

    https://www.deluxeblogtips.com/2012/06/relative-urls.html

    I can’t say that either of these work but I’ll be experimenting.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to use relative paths that would work after launch?’ is closed to new replies.