?
Solved

where is my 404 error page forwards link and where is forbidden 404 page in centos apache

Posted on 2014-08-29
10
Medium Priority
?
575 Views
Last Modified: 2014-08-30
Dear Experts,

I have two questions  for my apache Centos6 VPS server with root access, please advise
Question-1
I try to setup my own error.html for 404. But when include or NOT-include  "ErrorDocument 404 /error.html" in my .htaccess file, whatever both methods will  also go to error.html page when try to go to my testing site at http://mysite.com/store/no-this-file.html  on browser(which is not existing on the store directory that just for  testing). So somehow, I let it worked before or long time ago.
I can NOT remember where or when  I made the error.html page forward work, Besides error page forwards is enabled(ErrorDocument 404 /error.html) in .htacess file, where else apache server can make it  possible.I check /usr/local/apache/htdocs/, there is no any .htaccess

When I  go to check the httpd.conf file at /etc/httpd/conf/, there is NO any about error document handle stuff

.htaccess file
==============================
ErrorDocument 404 /error.html
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

Question-2
If I try to go to directory such as http://mysite/store on browser , it will show out
404 forbidden page, I want to know where is the forbidden page is located on my
apache Centos VPS server, I try to find it at /usr/local/apache, nothing find.
Where is the fobidden page located  ? because I want to do some css on it.

Fobidden page:
--------------------------
Forbidden

You don't have permission to access /store on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_bwlimited/1.4 PHP/5.3.21 Server at 212.1.209.242 Port 80
0
Comment
Question by:rwniceing
  • 6
  • 4
10 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1500 total points
ID: 40294184
'ErrorDocument 404 /error.html' should be only in .htaccess in the root of your web directories.

As for the 'Forbidden' message, that is not a page, it is text that is built-in to Apache.  If you want a page that you can 'style', then add other ErrorDocument pages like this:
ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /error.html
ErrorDocument 500 /500.html

Open in new window

0
 
LVL 1

Author Comment

by:rwniceing
ID: 40294196
I know when I change .htaccess file  at my public_html directory, I don't need to
restart httpd to make  the new update on .htaccess is  effective right way.
When delete "ErrorDocument 404 /error.html" in my .htaccess file,it also work, why ? Whatever I detele or add the "Error...." or restart httpd or not, it also work , Why ? So I guess somewhere apache did it  for me that I might did it a long time ago if .htacess did NOT do it.

Do you understand my question-1 ?

Please advise
0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 1500 total points
ID: 40294204
No, I don't understand your question.  Apache does not need the "ErrorDocument 404 /error.html" to put up an error message.  "ErrorDocument 404 /error.html" gives you the opportunity to show a custom error message of your own in a page called "error.html" in your root directory.

Also, Apache will read the .htaccess file (if it is there) every time a request is made for a page in that web site.  No restart is needed when you change the .htaccess file.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:rwniceing
ID: 40294207
I tried to detele it or NOT-inciude it  such as

#ErrorDocument 404 /error.html
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

it still works to get the error.html on my browser, why  ?
0
 
LVL 1

Author Comment

by:rwniceing
ID: 40294214
Now doing another test,  I copy error.html to error2.html
and enable it for error2.html as following new .htaccess file

.htaccess file
======================
ErrorDocument 404 /error2.html
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

the code ErrorDucument is also working for error2.html that is normal case and supppsed to be working. When I delete  or not-include it, it will go to error.html again.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40294220
All I can think of is that you have another copy of "ErrorDocument 404 /error.html" some where in the path or a 'conf' file.
0
 
LVL 1

Author Comment

by:rwniceing
ID: 40294230
Include "/usr/local/apache/conf/includes/errordocument.conf" that is
shown in httpd.conf. But nothing I can find about error.html

404.shtml is going to locate other page that is not error.html
errordocument.conf file
===================================
# 401 - Unauthorized
ErrorDocument 401 /401.shtml

# 402 - Payment Required
ErrorDocument 402 /402.shtml

# 403 - Forbidden
ErrorDocument 403 /403.shtml

# 404 - Not Found
ErrorDocument 404 /404.shtml


Now I think I need to find a string in a file for all directory to seach error.html string by the
following linux command with root access

grep -R "error.html" *
0
 
LVL 1

Author Comment

by:rwniceing
ID: 40294319
nothing find from grep -R "error.html"  besides those are not related

Is there any method to solve this  such as checking apache reaction to call error.html page  in
event log files so that I can see where apache module or php script to call error.html ?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40294744
I don't what else to tell you.  You can click on "Request Attention" above to get others to look at your question.
0
 
LVL 1

Author Closing Comment

by:rwniceing
ID: 40295066
Thanks for all of your, this thread is partially solved.
it will continue on next new thread with re-write question-1 and add more detail.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month16 days, left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question