Development

Automatically Change Links from Absolute to Relative

In this example I’m showing one way to quickly convert all a href and img src paths from absolute to relative. It’s quite a time saver, but I suggest committing your latest changes before trying anything here! If you aren’t using a version control system, make a backup somewhere… please! Note: Both of these commands are one-liners.

In the examples/results below, I tried to target most situations. You should see subtle differences between each example.

 

Leave a Reply

Your email address will not be published.