I'm creating a page that allows users to view the contents of a particular directory. I've set up the list to link to it's specific directory. The addresses should be [url]http://whatever.com,[/url] but for some reason they are coming up http://www.whatever.com so the page can be accessed. Is there some way of stripping the www? I've tried ereg_replace and other options, but nothing seems to work. Thanks for any comments.
<?php
$dir = "../mydir/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$url = "http://myurl.com";
print "<a href=\"$url/mydir". $file. "\" target=\"_blank\">$file</a><br>";
}
closedir($dh);
}
}
?>