Index files

Username (e.g. 23464544_) or Website URL

(please specify the website or account you are asking about)

Directory Listing

(please share the FULL error message you see)

Directory listing
Username (e.g. epiz_XXX) or Website URL epiz_23464544 Error Message Directory Listing Other Information all the files in htdocs are php files with one css file. There is also a database created using phpMyAdmin and a sql query. Does a an index.php file work the same as an index.html file? Sorry for the confusion. I’m new to this.

So long as it is defined in the .htaccess file (Which by default it is), yes. It will work exactly the same with the only exception being that it will run PHP.

I have downloaded the .htaccess file and all it shows is:

##################################################
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# Create a new .htaccess file in your htdocs
# directory (or example.com/htdocs/ directory)
# to add your own rules or override these rules.
#
##################################################


DirectoryIndex index.php index.html index2.html

ErrorDocument 400 https://infinityfree.net/errors/400/
ErrorDocument 401 https://infinityfree.net/errors/401/
ErrorDocument 403 https://infinityfree.net/errors/403/
ErrorDocument 404 https://infinityfree.net/errors/404/
ErrorDocument 500 https://infinityfree.net/errors/500/
ErrorDocument 503 https://infinityfree.net/errors/503/        

which does not look like anything I have seen in online tutorials. I really have no idea how to correct this. Any suggestions?

Hello, you downloaded the wrong .htaccess file.

The correct .htaccess file is located inside the ā€œhtdocsā€ folder.

1 Like

There is no .htaccess file in htdocs???

So just create one? The .htaccess file is just a file with the name .htaccess. You can just create a file like that through the file manager.

Also, please check the steps from this section to ensure you’ve setup your site correctly:

3 Likes

Thanks for this. Seems to have cured the problem but now I get an error message ā€˜Failed to connect to database!’ which I think may have something to do with this section of the following code, which is set to display this error. I have changed host name etc to those shown in my cpanel and physically checked that the database does exist.

<?php
function pdo_connect_mysql() {
    // Update the details below with your MySQL details
    $DATABASE_HOST = 'localhost';
    $DATABASE_USER = 'root';
    $DATABASE_PASS = '';
    $DATABASE_NAME = 'shoppingcart';
    try {
    	return new PDO('mysql:host=' . $DATABASE_HOST . ';dbname=' . $DATABASE_NAME . ';charset=utf8', $DATABASE_USER, $DATABASE_PASS);
    } catch (PDOException $exception) {
    	// If there is an error with the connection, stop the script and display the error.
    	die ('Failed to connect to database!');

Make sure the details of the Database are correct (You can show the host & username here)

Deleted everything and reinserted data. It appears to work! Only problem now is that the images will not display. I’ve been through all the files (copied from an external website) and changed the images src from ā€˜imgs’ to ā€˜htdocs’ but still no joy.

Try clearing your Browser Cache.

No joy. Still does not work.

May I know your domain?

I believe databases have the prefix, e.g epizy_12345678_[dbname]

htdocs is the folder of your website, but it’s not part of your URL. If your image is located in the folder htdocs/photos/2020/mountain.jpg, then the URL is http://example.com/photos/2020/mountain.jpg`.

Also, please note that our servers are case sensitive. So Mountain.JPG and mountain.jpg are different files.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.