I am new to Ubuntu and I am using Ubuntu Server 14.04. Now I want to use my own design HTML web pages as my server status errors like on 404 etc. I tried my own way but not getting my designed page and I am getting server default error page when I am opening that document is not available in my var/www/ as attached below.

enter image description here

I have index.html, 404.html, .htaccess files in my var/www/ folder. My .htaccess files contain ErrorDocument 404 /404.html line only. I didn't change any default setting. I just install Ubuntu Server 14.04 and using it via Terminal. Can you tell me what to do now?

  • @Rinzwind I know it and I tried it. Read my question again. But its not working. – Muhammad Hassan Aug 11 '14 at 14:23
  • @Rinzwind I didn't change any default setting. Yes. I restarted my Apache after adding .htaccess file codes using service apache2 restart. But still not showing my 404.html page. – Muhammad Hassan Aug 11 '14 at 14:28
  • Remove the / from ErrorDocument 404 /404.html in your .htaccess. I think that's your error. – Parto Aug 11 '14 at 14:30
  • @Parto I removed / and tried but not working. – Muhammad Hassan Aug 11 '14 at 14:31

Finally I searched and tried myself and got my code working. I found that I am not activating .htaccess files in my Apache2 service. I did the following steps and got it working.

Step 1:) First Open /etc/apache2/sites-available/000-default.conf File To Edit.

Step 2:) Add The Below Codes Just Before </VirtualHost> And Save This File.

AccessFileName .htaccess (.htaccess is the default filename)
<Directory /var/www/>
 Options Indexes FollowSymLinks Includes
 AllowOverride All
 Order allow,deny
 Allow from all

Step 3:) Now Restart The Apache Service Using Following Command In Terminal.

service apache2 restart

Step 4:) Its Done. Now Open Any File That Doesn't Exists And You Will Get Your Custom Designed Error File.

Note: Use the same .htaccess file as I added in my question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.