First sorry about my bad english. I use this in my PHP apps links: <?php $theURL = "http://example.com/files/528/Rabba Ho - Falak Shabir Song.html"; ?> <a href="<?= str_replace( " ", "_", $theURL ); ?>" target="_blank"> Rabba Ho - Falak Shabir Song </a> The above code returns a URL like: http://example.com/files/528/Rabba_Ho_-_Falak_Shabir_Song.html.