Forum Moderators: coopster

Message Too Old, No Replies

index.php

is it a good idea?

         

lZakl

12:05 am on Mar 4, 2005 (gmt 0)

10+ Year Member



I wanted to include some "dynamic text" on this page. It will be just a simple text file really that is changed every week.

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

badone

1:27 am on Mar 4, 2005 (gmt 0)

10+ Year Member



I don't believe it has any effect. The search engine only asks for "/" not "/index.php" it doesn't care whether it's index.php, index.shtml, index.html.

Cheers,
BAD

grandpa

9:36 am on Mar 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Will having it as an index.php affect it as far as being ranked in the SE's?

Not a bit.

What are the reprocussions of doing this (if any)?

The same as if you changed the name of any other page. When you change a page name it's akin to adding a new page. What happens when you add a new page? It has to go thru the waiting period of getting indexed (5 min. to 6 months). It has to develop its own PR, based on backlinks.

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]

lZakl

6:03 pm on Mar 4, 2005 (gmt 0)

10+ Year Member



grandpa,

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

garyr_h

8:21 pm on Mar 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually I wouldn't even use a redirect for the .php. I would just name it a .html file and then have apache parse html files into php that way both the visitors and search engines wouldn't know the difference.

Just add:

AddType application/x-httpd-php .php .htm .html

To your .htaccess file and you are all set.

lZakl

10:12 pm on Mar 4, 2005 (gmt 0)

10+ Year Member



garyr_h,

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

garyr_h

10:22 pm on Mar 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You put it into your .htaccess. It shouldn't make your visitors download the file.

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...]

whoisgregg

11:14 pm on Mar 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



lZakl,

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. :)