PDA

View Full Version : Trouble with htaccess


saifai
08-10-2006, 12:46 AM
I'm having trouble using an htaccess file for my php based archive (http://saifai.co.uk/fanfic/index.php).

I added in an .htaccess file to make sure the index and 404 pages were set. I thought maybe I would have had to use a php.ini file or something, but others using this script use a regular htaccess file. I set the index to a regular html file and redirected it to the php index (which originally I had done it that way because I couldn't get it to work setting it to index.php).

The problem is it didn't work. When you visit either the archive root (http://www.saifai.co.uk/fanfic) or an error page (http://www.saifai.co.uk/fanfic/error) when I've got an htaccess file in there it brings up standard issue browser warnings for "forbidden" on the index and "page not found" for the 404 errors.

Currently, I've got a blank htaccess file in there which ends up pulling up code for the pages listed in the htaccess file in my site root. Visit the pages in the above paragraph and you'll see what I mean.

I've contacted my site host to see if they knew what caused the problem, and they insist it's a coding error on my part. So, here's the contents of my htaccess files for both the archive and my site root.

Archive htaccess:
DirectoryIndex /index.html
ErrorDocument 404 /404.html

Site root htaccess:
DirectoryIndex /home.shtml
ErrorDocument 404 /404error.shtml

Any ideas on why this went wrong?

saifai
08-12-2006, 11:58 PM
Now I'm not sure why this worked out the way it did, but I ended up having to put the index and 404 files in the root directory rather than the directory where the archive resides. I only had to make sure the files were labeled with names other than what my root htaccess file uses.

My site host wasn't able to explain this one either.

Webgirl
08-15-2006, 11:02 PM
Check this thread

http://www.codingforums.com/showthread.php?t=93373