The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Can my index file be .php
oddcarout
post Feb 26 2012, 11:50 PM
Post #1


Member
***

Group: Members
Posts: 60
Joined: 21-November 06
Member No.: 1,017



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 27 2012, 12:39 AM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,478
Joined: 9-August 06
Member No.: 6



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.


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
oddcarout
post Feb 27 2012, 04:51 PM
Post #3


Member
***

Group: Members
Posts: 60
Joined: 21-November 06
Member No.: 1,017



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,
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
oddcarout
post Feb 27 2012, 05:07 PM
Post #4


Member
***

Group: Members
Posts: 60
Joined: 21-November 06
Member No.: 1,017



would I add:

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

Thanks
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 27 2012, 05:25 PM
Post #5


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,478
Joined: 9-August 06
Member No.: 6



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


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 1st October 2014 - 07:13 AM