Forum Moderators: coopster
If you currently have an index.htm or index.html, you can simply use meta redirects to index.php . Check on google for how to do this.
Check with your network administrator to set up your web server to deliver index.php as your default index page.
good luck,
Patrick Elward
I have thousands of URLs stored in a database. They need to be compared to each other for statistics. Some are like this: "mydomain.com/",
some are like this: "mydomain.com",
and others are like this: "mydomain.com/index.php"
The same is happening with hundreds of subdirectories, like "mydomain.com/stuff/" and "mydomain.com/stuff/index.htm"
What I need is a way to change them all into the verbose proper URI, with a string function, in the simplest way possible.
parse_url("http://www.mydomain.com");
returns:
Array ( [scheme] => http [host] => www.mydomain.com [path] => / )
but it doesn't fill in the missing "index.php" file name that I need to complete the URL.
So... none of the built-in functions I've found are doing the job. I think I might need to request the file from the server (in a hidden way) and parse what's returned? Is that possible?
your advice is highly appreciated
I think the answer I need will involve sending a request to the server, letting it serve up the correct default page, then parsing the returned result. I wonder if I can grab $HTTP_SERVER_VARS from a page loaded with "fsockopen()" or something like that? I'm not sure where to start with that idea, but wouldn't it make a nice all-purpose function to have in the PHP library?
The result will be a nice "resolve_real_URI" function that goes beyond the basic string splitting functions offered in PHP.
I'm still hacking away...
I'm still left with all this legacy data that has been accumulating for months and months... Any ideas how to resolve a URL into its verbose form by hitting the server with a request?
parsing the directory structure and storing all fully qualified script names, then cross referencing your partial data with the actual list of pagenames.
if index.php is the most common, making an array of dirs that have other default page names and using that to qualify partials
it really depends, if everything is all over the place then the first may be the most reliable.
This is just legacy data conversion so the key is accuracy not speed or ease.
Though it took a lot of manual effort, I replaced all the old values with new "verbose" ones by looking up things on the server and doing some search/replace work.
I still wish there was a built-in or cookbook solution for that problem, but I'll put it aside for now since all my legacy data has been converted the "hard way".