Does anyone know a good regex that will make these two changes to the same url? a) add a folder name to the url b) add .html at the end of the url I will prefer to do this on the html code rather than on the fly. So from: <a href="http://mydomain.com/url1"> <a href="http://mydomain.com/url2"> etc.. To <a href="http://mydomain.com/folder/url1.html"> <a href="http://mydomain.com/folder/url2.html"> etc.. Many thanks.
I would go for something simple and do: str_replace('http://sitename.com/','http://sitename.com/folder/',$text); if you parse it once itll work fine else you will want to use "folder/" as the stop condition in your ereg_replace