Page 1 of 1

.htdocs almost working

PostPosted: 16. January 2017 18:27
by sadhu
xampp 5.6.28 for linuxmint 17 64-bit

I use xampp on non-networked machines (desktop and laptop). Only I have access to these machines, so I'm not too worried about security, unless I'm hacked while browsing the internet. I use xampp to run a local copy of my web site for development purposes.

The problem is the .htaccess directive "ErrorDocument 404 /404.shtml" works on the remote site, but not locally.

I've tweaked httpd.conf, making only this change:
Code: Select all
<Directory />
    AllowOverride All
    Require all granted
</Directory>
Now my tiny two-line .htaccess file works almost, but not quite
Code: Select all
DirectoryIndex index.php
ErrorDocument 404 /404.shtml

The DirectoryIndex works: I get my nicely-formatted php index page when I point my browser to hocalhost/mysite. BTW if I delete. .htaccess, then I get the index.html file

So .htaccess works for line 1, but I still get the default 404 error, not my custom one. On the remote site the custom error page works properly.

I need to edit and test the custom 404 page locally before I upload it, as it's going to do some heavy parsing of the bad URI, then present a "best guess" redirection.


Thanks
Sadhu

Re: .htdocs almost working

PostPosted: 17. January 2017 12:10
by Nobbie
You probably stored 404.shtml into the wrong folder (where is it stored), its a bit tricky where to put it. Here is a usefull posting from another forum with quite the same problem and some usefull hints:

http://stackoverflow.com/questions/2297 ... ile-in-php

Last not least, the file may have insufficient rights and/or Apache is not allowed to read it (via AllowFrom / Require). I think you should find an entry in your acces_log and or error_log about the missing 404.shtml Anyway, it looks as if you use the very very outdated SSI syntax for that file, you definately should replace that by PHP or similar. I even did not check if SSI is activated in a Xampp environment per default.