I'm making a website, and my index is a php file, whereas the other 6 pages are html. Whenever I click on the "Home" button, it says that it can't find index.html, but that's obvious because it's called index.php. Any way to fix this? If I'm being too vague, then please let me know what information I can provide you with to help you help me. Thank you!

Do checked your home menu URL ? What u have provide? index.php (or) index.html ?

Do checked your home menu URL ? What u have provide? index.php (or) index.html ?

The name of the file is: "index.php," and all the links link to "index.php"

Member Avatar for Zagga

Hi rfrapp,

I'm guessing your 'home' button doesn't actually link directly to index.php but just to the root directory. When a directory address is requested, the default action is for it to load index.html

You can change this by adding the following line to a .htaccess file DirectoryIndex index.php index.html The default action will now be to try and load index.php and if it can't find that to load index.html

Hi rfrapp,

I'm guessing your 'home' button doesn't actually link directly to index.php but just to the root directory. When a directory address is requested, the default action is for it to load index.html

You can change this by adding the following line to a .htaccess file DirectoryIndex index.php index.html The default action will now be to try and load index.php and if it can't find that to load index.html

Thank you very much! So where exactly would that file be located? Sorry, I'm new to PHP.

Member Avatar for diafol

Could you at least print out your links here to stop us guessing? e.g.

<a href="/index.php">home</a>

You've got php installed? Is this local or remote server?

Member Avatar for Zagga

Hi again,

If you have a .htaccess file already it should be in the same folder as your index.php page. If you don't already have one you can create your own. Use notepad or another simple text editor, type in the line I gave you in my last post, then save the file as
.htaccess (notice the dot)
NOT
.htaccess.txt
It's a bit of an odd way to name a file but that's the how it is :)

Hi again,

If you have a .htaccess file already it should be in the same folder as your index.php page. If you don't already have one you can create your own. Use notepad or another simple text editor, type in the line I gave you in my last post, then save the file as
.htaccess (notice the dot)
NOT
.htaccess.txt
It's a bit of an odd way to name a file but that's the how it is :)

That worked perfectly! Thanks again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.