Forum Moderators: mack
I have an old site, which was written in php almost two years ago. Now having better php skills I've written a new and brilliant (that's what I think) script.
The old site is generally an index.php displaying different categories like:
index.php?cat=Category%20Name1
index.php?cat=Category%20Name2, etc.
This index.php file has a high Google PageRank and I don't want to lose it.
So the idea is to leave this old script and the index.php file as an archive and to have an index.html as a doorway to the new site, which will have separate files for each category and subcategory like keyword-phrase.php etc.
How do I best solve this?
Thanks
You should never expose index files at all.
If your site is example.com, you should NOT be distributing links to example.com/index.php, example.com/index.html, or example.com/index.anything.
Links to your site should be to example.com.
Period.
A user who types-in example.com/index.html, or a misguided webmaster on another site that links to it should get either a 404 error or (better) a redirect to your home page in proper canonical form. (e.g. example.com).
Leave the old index.php, have it 301 redirect to example.com/, don't expose example.com/index.html to the world, and have new inbound links go to example.com/
Index files were never intended to be exposed in a URL using their file name. Yet I'd guess that 50% of web servers are mis-configured to do so.
adwatson, jimbeetle: I am reluctant because Google has indexed 130 different combinations of my index.php?cat=Whatever%20Category
My new index will not have those cat attributes anymore. Then in my Google Webmaster tool I will see a warning about 129 broken links next time I log in. That could kill my traffic. Google has been kind to me and I get approx 80% of traffic from it.
Unless I redirect them all. What kind of redirect is better?
jtara Yes, all my incoming links point directly to the domain not index.
Leave the old index.php, have it 301 redirect to example.com/
Then Google will still be able to access my old index.php. I know I made a mistake two years ago but now I need to continue somehow without losing all my 130 indexed urls.
Usually, when a request comes in for example.com, servers search through specific file names and the first one that shows up is the file that's sent to the client.
So, you could have index.html, index.php, default.html, welcome.html all in the same root directory.
You can set up your server so a HTTP request to example.com would return the index.html file, while keeping the index.php live for the search engines and/or links from within index.html/other pages.
Contact your server admin.