PDA

View Full Version : Workaround for htaccess error?


saifai
08-08-2006, 08:55 AM
My archive (http://www.saifai.co.uk/fanfic/index.php) uses PHP software. I added in an .htaccess file to make sure the index and 404 pages were set (I had set the index to a regular html file that used a redirect to get me to the PHP pages within the archive).

It didn't work and just brings up standard issue browser warnings for "forbidden" on the index and "page not found" for the 404 errors.

Without the .htaccess file, or a blank .htaccess file in place, the server tries to pull the index and 404 pages set for the root directory. If I visit the archive root (http://www.saifai.co.uk/fanfic), then it just throws me into a page using the html from my main index page (http://www.saifai.co.uk/). It's the same with the 404 page.

I can't figure out why the .htaccess file isn't working. No word yet from my servers.

My question: Is there a way for me to use me root .htaccess file to redirect requests to the proper pages?

yeti
08-08-2006, 09:25 AM
I suppose this question should be moved to a server side development forum...

Kravvitz
08-08-2006, 09:30 AM
saifai, perhaps if you showed us the contents of the .htaccess file, we might be able to spot the problem for you.

yeti, there isn't a forum for web servers here. This would probably be best placed in the General Web Building forum.

saifai
08-08-2006, 09:53 AM
The htaccess file for my archive (http://www.saifai.co.uk/fanfic/index.php) which I've placed in the "fanfic" directory:
DirectoryIndex /index.html
ErrorDocument 404 /404.html
Using the htaccess file for my archive, all I get are the standard browser defaults of "forbidden" for the index and "page not found" for the 404.

I currently have a blank htaccess file in my archive directory since using the code doesn't seem to work. Visiting the archive directory (http://www.saifai.co.uk/fanfic/) brings up a page with the html code for the page referenced in my root htaccess file, and the same goes for error pages (http://www.saifai.co.uk/fanfic/error).

In case you're curious, the htaccess file in my site root (http://www.saifai.co.uk/) (and this one works fine):
DirectoryIndex /home.shtml
ErrorDocument 404 /404error.shtml

saifai
08-12-2006, 11:05 PM
I'm still not sure why this happened, but I did figure out a way to make my htaccess file work. I had to put my index and 404 files in my root directory rather than the directory of my archive.

There were a few problems with that: 1) I couldn't use a php file for either of them (so they both had to be either htm or html, 2) I had to make sure the files were named something different than what my root htaccess uses (another reason for specifying either htm or hmlt since my entire site, bar the archive, uses shtml).

Go figure.