0

I want put some codes like below in my htaccess file:

ErrorDocument 403 /error/403
ErrorDocument 404 /error/404
ErrorDocument 500 /error/500
...

and have a PHP file which handles the error pages for me using GET ( file.php?a=404 ).

Now, I only need a htaccess code to rewrite the "/error/404" to "file.php?a=404" for me. What should I do ?!

3 Answers 3

1

There's several other error documents that you might wish to customise. 400 - Bad request 401 - Authorization Required 403 - Forbidden directory 404 - Page not found 500 - Internal Server Error

For each one you want to use, simply add a line to your .htaccess file and create the corresponding page.

ErrorDocument 400 /errors/badrequest.html
ErrorDocument 401 /errors/authreqd.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/serverr.html
Sign up to request clarification or add additional context in comments.

Comments

0
ErrorDocument 404 /path/to/file.php?a=404

Comments

0
ErrorDocument 404 /path/to/yourfile.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.