Jump to content

Convert Relative to Absolute links


yyx748

Recommended Posts

This is my RSS

 

managed to work except for one last thing.... all relative links arent working properly, namely links and images.

 

http://www.phyllisquek.com/feed/test/

 

How do i correct it? All my web links are in relative, example, /content/image.jpg

 

I tired str replace by replacing all src=" and href=" to src="www.exmaple.com/ and href="www.example.com/

 

But this would screw up all external links and images like http://www.cnn.com

 

Help!  :'(

Link to comment
https://forums.phpfreaks.com/topic/168808-convert-relative-to-absolute-links/
Share on other sites

You'd probably want to look at preg_replace to do what you're looking to do.  You'd need to build a regular expression that would take care of it.  You can get more info on preg_replace here:

 

http://www.php.net/preg_replace

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.