I am running an Apache server on my Raspberry Pi with PHP, and I want to create a .htaccess file to redirect 404 errors and remove .html extensions on URLs. I have tried simply running 'sudo nano .htaccess' and a new file was created, but after I updated it with 404 error redirection (and saved the file) it didn't work. Could anyone help me with making a working .htaccess file?
EDIT The output of ls -la /var/www is:
total 216
drwxr-xr-x 14 alex root 4096 Feb 16 07:58 .
drwxr-xr-x 12 root root 4096 Jan 17 21:26 ..
-rw------- 1 alex alex 6375 Feb 15 21:16 .bash_history
drwxr-xr-x 2 alex alex 4096 Jan 24 08:55 blog
drwxr-xr-x 9 alex alex 4096 Jan 25 20:18 .cache
drwxr-xr-x 8 alex alex 4096 Jan 25 20:21 .config
drwxr-xr-x 3 alex alex 4096 Jan 24 14:55 d
drwx------ 3 alex alex 4096 Jan 25 20:15 .dbus
drwxr-xr-x 3 alex alex 4096 Feb 16 07:58 Desktop
drwx------ 2 alex alex 4096 Jan 25 20:15 .gvfs
-rw-r--r-- 1 root root 30 Jan 24 14:55 .htaccess
drwxr-xr-x 2 alex alex 4096 Feb 15 20:40 .idlerc
-rw-r--r-- 1 alex alex 1770 Jan 24 09:47 index.php
drwx------ 3 alex alex 4096 Jan 25 20:17 .local
drwxr-xr-x 3 alex alex 4096 Jan 25 20:15 .scratch
drwxr-xr-x 2 alex alex 4096 Jan 22 19:37 style
drwx------ 4 alex alex 4096 Feb 15 20:33 .thumbnails
-rw-r--r-- 1 alex alex 99678 Jan 21 17:11 wagicallogo.ico
-rw-r--r-- 1 alex alex 15719 Jan 21 17:10 wagicallogo.png
-rw------- 1 alex alex 100 Feb 8 13:05 .Xauthority
-rw------- 1 alex alex 17621 Feb 15 21:16 .xsession-errors
And my 404 error page is /d/404.html
EDIT 2 Here is my 'ls -la /var/www/d':
total 24
drwxr-xr-x 3 alex alex 4096 Jan 24 14:55 .
drwxr-xr-x 14 alex root 4096 Feb 16 07:58 ..
-rw-r--r-- 1 alex alex 925 Jan 24 14:51 404.html
-rw-r--r-- 1 root root 1084 Jan 24 11:30 group.php