Forum Moderators: coopster
To include this on my page I have decided to just make it an index.php page. My question is:
Will having it as an index.php affect it as far as being ranked in the SE's? What are the reprocussions of doing this (if any)?
Any input appreciated,
Thanks!
-- Zak
Will having it as an index.php affect it as far as being ranked in the SE's?
What are the reprocussions of doing this (if any)?
You already have an index.html (I assume) that is indexed and has PR. So there is no reason to lose all of that and start over because you want to change the page name, right? The solution is to use Apache's mod_rewrite module. A sample mod_rewrite would look like this:
RewriteEngine on
RewriteRule ^index.html$ http://www.example.com/index.php [L]
One important aspect of this example, there is NO Redirect code. In other words, the php page will simply be served up instead of the html page. From the outside (the internet) there will be no difference. Everyone, bots included, will think they are reading your html page. You could add a redirect code [R=301] and this says to the world, "Hey, my old page has been permanently moved to my new page". This may affect your ranking and will affect your exisiting PR, but only for a short period of time... which could in reality be a day to 3 months. Nearly every PHP page on my site had been re-written like the example with no negative results.
Please refer to mod_rewrite documentation before implementing this solution. You may one of those fortunate people who can read it and grasp everything within on the first read... I learn something new ever time I read it and may never fully understand Apache!
Is he still talking?
Yes, there is one more thing, which I did not discover for quite a while. Look at the headers produced by your html page. You will see a line in the output similar to this:
Last-Modified: Wed, 09 Feb 2005 06:38:42 GMT
As far as I know, default PHP page headers do not include the Last-Modified information. So you may want to modify your headers to include at least that much.
This link will let you check your server headers [webmasterworld.com]
Just what I was looking for, a way to switch over, but with minimal possible damage. I took your advice and read about the mod_rewrite module. That's a pretty nifty tool. Good for lot's of applications, some of which I was unaware were even possible... I found myself writing down all kinds of stuff for future reference, because I could see me needing something that it can do in the future, and saying "where did I read that?"
Thanks again!
-- Zak
Just add:
AddType application/x-httpd-php .php .htm .html
To your .htaccess file and you are all set.
I tried this, except it gives all my browsers the same type of dialog box when I try to open the page:
Firefox:
You have chosen to open
which is a: application/x-httpd-php
from: [example.com...]
What should Firefox do with this file?
Open with "Choose
Save To Disk
[] Do this for files like this automatically from now on.
Explorer:
Internet Explorer doesn't know how to handle the type of file you have selected.
You can choose to save this file to your disk, or you can configure a Helper Application for this file
MIME Type: application/x-httpd-php
File Name:
[]Cancel [] Save File [] Plugin [] Application
Safari
Just automatically downloads the page to my desktop.
What does this accomplish exactly? ;0)
(there MUST be a flaw in what I did, but I promise I just put that line in my .htaccess file.) As soon as I removed the line, all went back to normal.
No offense, but I don't want my visitors having to download the page to view it.
-- Zak
Adding the line to your .htaccess simply tells the server to parse the files into php even though they have the extension .htm or .html.
If this is what you are doing and for some reason it is still asking you to download, I suggest you see [webmasterworld.com...]
I just went through that same problem with my web host... The one line that works every where else just happened to not work on their server configuration.
The solution for me ended up being this line in my .htaccess (instead of the AddType above):
AddHandler php3-script .html But the real advice here is tell your host the problem and let them sort it out. :)