Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ Can my index file be .php

Posted by: oddcarout Feb 26 2012, 11:50 PM

I used PHP to build my site.

I originally used home.php.

Can I have my home or index file by .php?

right now I have an home.html that points to my home.php. What is the correct way to do this?

Please help.

Thanks.

Posted by: pandy Feb 27 2012, 12:39 AM

You mean index file as in the file that will be served up if you go with a browser to a directory? It can be anything you like but you must have a way to configure the server. On Apache this is done with a .htaccess file, a configuration file that works on per directory basis and can be used on a shared server.

It's likely the server is already configured to use index.php though. Have you tried? There actually is a list of files. As an example that could be "index.php,index.shtml,index.html". The first file on the list is the server's first choice. If it doesn't exist it looks for the second file on the list and so on.

home.php would work as well provided the server is configured to use it. But if it uses home.html, maybe it uses home.php too. If not, you can use the .htaccess file if you are on Apache. Don't know about other servers.

Posted by: oddcarout Feb 27 2012, 04:51 PM

I have exactly one line in my htaccess file and it is for a script that I have.

can't find it on my hosting server options.

How can i do it in the htaccess file?

Thanks,

Posted by: oddcarout Feb 27 2012, 05:07 PM

would I add:

DirectoryIndex home.php index.php home.html index.html

Thanks

Posted by: pandy Feb 27 2012, 05:25 PM

Yes. But check if it already works first. Something made home.html work, right?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)