Forum Moderators: coopster
If I get ride of the index.html page and replace it with index.php page and then change all of my internal links to point to the new page will everything work properly?
DirectoryIndex index.html index.php
This will use either index.html or index.php as the directory index. If you are going to change your homepage to index.php, it will then be the directory index. This may be already implemented if you are using a hosting company.
>>>will everything work properly
It should :)
Good luck!
I set the Directory Index and I am ready to go.
Just one last thing, should I have all my internal links point to site/index.php or just site/
I have read different opinions about linking to the actual file. I just want to know which way is the best for seo, etc.
Also, should I use some kind of redirect for sites that link to my index.html page. My index.html page has been active for 4 years so I assume there are a number of sites etc. that link to the www.example.com/index.html
If I should use a redirect which one would be the most search engine friendly? Will changing from index.html to index.php with a redirect cause any search engine problems?
redirect 301 /index.html http://www.example.com/index.php
I also directed all of my old internal links to ../index.html to /
Now no matter if you type in site.com or click on an internal link / the address goes to site.com/index.php never simply site.com. Will this cause any search engine problems? If I take the redirect out then it will serve the php page without the index.php. Does this matter and why do my external and internal links only go to site.com/index.php and not simply site.com when I have 301 redirect active even if I am not typing in the old index.html extension?
[edited by: jatar_k at 5:58 pm (utc) on Oct. 12, 2006]
[edit reason] examplified [/edit]
Are you adding some real dynamic php code over there? or just renaming .html to .php and changing links accordingly
I was using the following code in .htaccess to execute .html pages as PHP:
AddType application/x-httpd-php htm html
I was told and read in forums that this was a waste of resources since my site is almost entirely static html pages because the code above will have the server scan everypage being accessed for php content.
I am not sure if changing the homepage to .php file is a good idea but I am giving it a try.
Do you have any php scripted code on your homepage that performs a "dynamic" function?
In other words, did you add code to your html that starts with "<?php" then has specific code that performs dynamic functions and ends with "?>" - it would look similar to this stuck in the middle of your regular html:
"<?php
$id = $HTTP_GET_VARS[id];
//find file someguy
$someguy_query = "Select someguy from somefile where (someguy_id = '$id')";
$someguy_result = mysql_query("$someguy_query") or die(mysql_error());
$myrow = mysql_fetch_array($someguy_result);
?>"
If not ... then it is not a php "dynamic" page. It is still just a static html page and using the php extension is pointless.
I would suggest using .htaccess to change the directory listing order so that when someone tries to access site/ they are served index.php by default. Leave the current 301 redirect in place so that SEs and anyone following old links will still get taken to the new page.
Use this code in your .htaccess file:
DirectoryIndex index.php index.html This means that if index.php is present, it will be served first, and then index.html is served if index.php is not present.
Replace your index.html with this:
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>redirect</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="0;URL=http://www.somesite.com/index.php">
</head>
<body>
You are being redirected to our new home page. If you do not get there automatically in 5 seconds, <a href="http://somesite.com/index.php>click here</a>
</body>
</html>"
But if you also have permenant redirects in place on your server, than the bot should be smart enough to realize that the temp is a backup to the perm.
Anyone, please correct me if I am wrong.
Dave