How to get relative links to work in a local host with a sub-directoty ?
-
Since I restore my online backups to my local host sometimes and it’s important that all links and images work well without having to change anything, I use relative links in my WordPress/ WooCommerce posts instead of absolute links.
So let’s say the following is a relative image link that I use in one of my posts:
/wp-content/uploads/image.jpg
and here is my local host:
In order for the relative link to work on the local host I need to edit the post and add /my-local/ right before the relative link:
/my-local/wp-content/uploads/image.jpg
The problem is, I don’t want to make any changes to posts. is there any hook or filter I can use on my local host to temporarily add /my-local/ right before the relative links so that I can see the images and links without having to replace or change anything ?
- The topic ‘How to get relative links to work in a local host with a sub-directoty ?’ is closed to new replies.