FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Apache Default Page if No file exists





Possum
I get this page if I have no index (home Page)_



How can I change this to a Document Not Found Page

Or is it a 400 error. I forget..

Thx
deanhills
Create an 404.html "Not Found" file and save it to the root of your domain. Use any wording you like in it. Then create an 404 .htaccess file. Here's a tutorial:

https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file

Quote:
To make a page look friendlier and to provide more information to the site visitor than the default server error page offers, you can use the .htaccess file to create custom error pages.

Im going to create a 404 page in this tutorial. However, you can substitute that error for whatever you prefer:

Once you have created and uploaded desired error page, you can go ahead and designate its location in the .htaccess file.

Code:
ErrorDocument 404 /new404.html


Keep in mind that the Apache looks for the 404 page located within the site's root. If you placed the new error page in a deeper subdirectory, you need to include that in the line, making it look something like this:

Code:
ErrorDocument 404 /error_pages/new404.html
andy26
Side note not exactly to do with your question but i noticed your using apache on the raspberry pi, I would very highly recommend using nginx instead it is a lot lot less bloated on memory which makes it perfect for the pi. I setup an nginx webserver on my pi so that i can control light switches in my house and it works great.

There are some good tutorials out their if you want i can find the one i followed to help you install nginx, and with nginx by default it doesnt show a list of files when there is no index.php / html it shows a 403 forbidden page.

Apache is definitely better when it comes to high volume traffic and it has native php built in making it much better for production servers such as the one i manage for my work place, but for something like the pi nginx is where its at.
Possum
Thx everyone.

Yes my wee PI is running apache.

I will be moving up to a more robust computer. But just using the Pi as an learning tool..

The Zero.. (yes PI Zero) is a work horse..

Cheers..
andy26
the pi makes a great little home server, so far i have had a 100% up time on my Pi 3 it has been running for roughly 9-10 months i haven't killed the SD card yet which is good i heard so many complaints about people killing their cards I think spending 16 on a good quality branded 32gb SD card was key. I was thinking about investing in a backup battery to make it even more reliable mostly because upon reset all of my house lights turn on at the same time XD.

Its such a shame that my ISP blacklists all residential IP's on a certain blacklist site so i cannot properly configure my mail server unless anyone on here can help? I am using Virgin Media in the UK?
Possum
Andy26 You might want to look at https://sendgrid.com/

I just found out about them. So I don't know too much

Also if you have concerns about your SD card burning up too soon you might want a Zero4U if you have a Pi Zero

Just a quick question. Do you know if it is possible to have an email address that includes an IP address for instance

peter@256.54.35.49

Thx
Related topics
A "small" list of free apps
How To : Secure Your PHP Website
I need help setting up a default index file?
[RESOLVEd] How to set the default page ?
default files sequence
Problem index page
Displaying A Default Page Not Found.
General .htaccess tutorial.
Is index.html different from public_html.html
Apache
how to check if a file exists. please help (visual basics 6)
My java applet can not find class file on the server
Making a file the home page
vBulletin installation: Files upload, Database setup
Warning: mkdir(): File exists
Reply to topic    Frihost Forum Index -> Webmaster and Internet -> Websites

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.