.htaccess file for index page load of homepage

I would like to make an entry in my .htaccess file so that when someone goes to my website the first page that will load will be index.php (as of now index.HTM is loading) I added the entry:

DirectoryIndex index.php but after i upload the file to the server i get the error:

Unknown method DirectoryIndex

the only other line of code that i have on that .htaccess file is

ErrorPage 404 /404.php

so the full .htaccess file looks like this:

ErrorPage 404 /404.php
DirectoryIndex index.php

am i doing something wrong? or is another way to make the server load index.php instead of index.htm?

The server (website) is being hosted by my ISP and they offer to redirect however a redirect is not what I am looking for
LVL 1
James HilloyaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aboo_sCommented:
If you delete index.html or rename it then by default index.php will be displayed if found!
No need for adjusting .htaccess

That is in APACHI which is the most common server, I beleive other servers act the same as well.
0
James HilloyaAuthor Commented:
Thanks for your response but Deleting the index.html access is not an option....i need to keep that file there and also renaming it is not an option nor redirecting it
0
aboo_sCommented:
Why would you want to keep it, if you want index.php to be displayed first !?

Anyway it would be easier to set it so, that in your first visit to index.html it would redirect you to index.php!
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

James HilloyaAuthor Commented:
sorry but i cannot say why....i just have to keep it...all i want is to edit the .htaccess file so that the server looks first for index.php
0
aboo_sCommented:
ok, try this in your .htaccess :

DirectoryIndex index.php index.html

instead of this:
DirectoryIndex index.php
0
James HilloyaAuthor Commented:
should that be line 1 or line 2? or does it matter?
0
James HilloyaAuthor Commented:
this is what my htaccess file would look like:

ErrorPage 404 /404.php
DirectoryIndex index.php index.html

is that good?
0
James HilloyaAuthor Commented:
tried it and get error: Error parsing access file
0
aboo_sCommented:
Please try this instead, and let me know what happens:
ErrorDocument 404 /404.php
DirectoryIndex index.php index.html
0
James HilloyaAuthor Commented:
Just spoke with the people that host my website...they say they use a modified version of Apache ...and it does not support changing the order of what index pages loads first...i guess that explains why when i change the htaccess file it does not work....i guess i am out of options...i wish i could delete the index.html page but I can't.....( we use that page for other reasons )...not sure what I can do...in out of options
0
aboo_sCommented:
It doesn't make sense that a modified version doesn't support older options, I would suggest you do try my last post.Anyhow, and I'm just guessing here, if the reason u created your index.php is just to run php scripts then you can add a line to your .htaccess that will make php run in html docs:
AddType application/x-httpd-php .php .htm .html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.