Gerwin
Gerwin

Reputation: 1612

.htaccess error's not working as intended

I have several .php pages which I use URL rewriting for, and I have one page which I'm not using url rewriting for.

In my .htaccess file I've written the following:

ErrorDocument 404   /Reducation/Aarde/errors/404.php

This works for the one page which I'm not using URL rewriting for.

However when I visit a page with URL rewriting and incorrectly type the url, like: http://localhost/Reducation/Log-in/Regi It displays the standard XAMPP 404 error, instead of my custom one, is there any way to solve this or is there anyway to disable the standard XAMPP 404 message?

This is the error message displayed, along with the regular Object not found:

Error 404

localhost
Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.6

I've tried the following:

ErrorDocument 404   /Reducation/Log-in/errors/404.php
"ErrorDocument 404   /Reducation/Log-in/errors/404.php"
ErrorDocument 404 /errors/404.php

My source.

Edit: My assumption is that it doesn't work when I rewrite the url because the paths don't match up to errors

I've just tested out what I believed it to be, and it seems that I'm correct, it doesn't work because the paths don't match. Is there a work around for this?

Upvotes: 1

Views: 77

Answers (1)

anubhava
anubhava

Reputation: 784888

To disable xampp 404 custom handler use this line as first line in your root htaccess file:

ErrorDocument 404   default

404 URI must be absolute, I.e. either it must start with http:// or a / making it relative from DocumentRoot and exact same URL must work in the browser if entered directly.

Upvotes: 1

Related Questions