Browser won't recognize .php extension for index page

10 posts by 3 authors in: Forums > CMS Builder
Last Post: February 25, 2009   (RSS)

By edg1 - February 24, 2009

I am a beginner with CMS Builder. I completed my website using html pages with Dreamweaver before integrating CMS Builder. I've been learning the way CMS Builder works and integrating it into my existing pages.

My question is, can i leave my page extensions as html, or do i need to change the extentions to php?

Thanks in advance for any help!
Anna

Re: [amb29] Browser won't recognize .php extension for index page

By Kenny - February 24, 2009

Anna -

Without some elaborate work-arounds, it is best to make sure your extensions are .php if you can help it.

Kenny

Re: [sagentic] Browser won't recognize .php extension for index page

By edg1 - February 24, 2009

Thank you Kenny -

My next question is – if the php extension is necessary, how do i get a browser to default to index.php instead of index.html when the url is entered? No one will know to type in "index.php" at the end...

Thanks again,
Anna

Re: [amb29] Browser won't recognize .php extension for index page

By Kenny - February 24, 2009

Anna,

You will need to get rid of the index.html or rename it to something else.

index.php will replace your index.html

Most servers have default settings about the order in which a default file is presented. typical order is:

index.html
index.php
default.html
default.php
home.html
home.php

The browser looks for one of these files as the default page to present based on the servers preferences. If you don't have a index.html, it will start looking for index.php instead.

I hope that makes sense. Let me know if you have any more problems.

Kenny

Re: [sagentic] Browser won't recognize .php extension for index page

By edg1 - February 24, 2009

Thanks again, Kenny.

I actually do not have an index.html, only an index.php, and i was getting the following error message:

'Error 403 - Forbidden
You tried to access a document for which you don't have privileges.'

I googled a way to redirect a url and found that i can redirect '/index.html' to '/index.php' using Apache in a plain text document named ".htaccess" I did that and it worked - is this the best way to redirect a url?

Thanks,
Anna

Re: [amb29] Browser won't recognize .php extension for index page

By Kenny - February 24, 2009

That works, but I would highly recommend asking your web host to configure Apache to allow .php in the Directory Index.

Do other .php pages work properly?

Re: [amb29] Browser won't recognize .php extension for index page

By Dave - February 24, 2009

Hi Anna,

Asking your host is the best first step. But depending on your hosting setup, some let you change some of the settings yourself with .htaccess files. If your host allows this the following directives let you setup index.php as a default file (followed by index.html if there is no index.php):

DirectoryIndex index.php index.html

Next, it is also often possible to have your web server treat other files (such as .html) as php even if they don't have the extension. There's more info about that here: http://www.google.com/search?q=html+files+as+php

But to start, you're probably better off to stick with .php for php and .html for HTML and get the server configured properly to show index.php files by default.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Browser won't recognize .php extension for index page

By edg1 - February 25, 2009

Thank you, Dave -

I contacted my hosting company and they said the issue was that my "Index.php" started with a cap 'I'. I'm assuming that's a standard that I wasn't aware of. So my 'index.php' with a small 'i' is showing up splendidly now! Thanks to you and Kenny for all the help - you guys are great!

Anna

Re: [amb29] Browser won't recognize .php extension for index page

By Dave - February 25, 2009

Thanks for posting back. Glad to hear it's working! :)
Dave Edis - Senior Developer
interactivetools.com