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!

Re: HTML files linking to an index.php file 80 80

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

Re: HTML files linking to an index.php file 80 80

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"

Re: HTML files linking to an index.php file 80 80

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

Re: HTML files linking to an index.php file 80 80

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.

Re: HTML files linking to an index.php file 80 80
Member Avatar

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?

Re: HTML files linking to an index.php file 80 80

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 :)

Re: HTML files linking to an index.php file 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.