Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
n3pla
New Member
New Member



Joined: Mar 02, 2012
Posts: 6

PostPosted: Sat Mar 10, 2012 3:11 am Reply with quote

I had to change my ErrorDocument section of my htaccess. This is a new installation everything works fine with the changes. However, I fear a possible looping problem for a 404 error. Here is the original htaccess:

Code:
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) modules.php?name=ErrorDocuments&file=404&rs=$1 [NC,L,R]

ErrorDocument 400 /modules.php?name=ErrorDocuments
ErrorDocument 401 /modules.php?name=ErrorDocuments
ErrorDocument 403 /modules.php?name=ErrorDocuments
ErrorDocument 406 /modules.php?name=ErrorDocuments
ErrorDocument 500 /modules.php?name=ErrorDocuments


and changed it to the

Code:


#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule (.*) modules.php?name=ErrorDocuments&file=404&rs=$1 [NC,L,R]

ErrorDocument 400 /modules.php?name=ErrorDocuments
ErrorDocument 401 /modules.php?name=ErrorDocuments
ErrorDocument 403 /modules.php?name=ErrorDocuments
ErrorDocument 404 /modules.php?name=ErrorDocuments
ErrorDocument 500 /modules.php?name=ErrorDocuments


Note: I removed the 406 error simply because the server I am using gives me 5 html files that I could modify to make them look like my web site these are for the same 5 errors I chose to reflect in my htaccess. When I used the original code the 404 error did not function. I could not think of a way to test the other errors, but the 404 continued to default to the 404.shtml file. What changes could I try to revert back to the original RewriteCond type error handler for 404 errors. I want to be sure there is no chance at looping.
 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sat Mar 10, 2012 9:33 am Reply with quote

This one may take some time to answer because I am of sure how many people are familiar with the workings of this.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
n3pla







PostPosted: Thu Mar 15, 2012 6:45 pm Reply with quote

 
n3pla







PostPosted: Thu Mar 15, 2012 6:47 pm Reply with quote

Oops
http://www.askapache.com/htaccess/modrewrite-tips-tricks.html
 
n3pla







PostPosted: Thu Mar 15, 2012 6:52 pm Reply with quote

P.S. I have noticed that the Error Handling for Raven Nuke is not correctly reflecting the original URL that was causing the error. The data in the reflected shows the entire URL used to generate the error message rather than the URL of the "missing/deleted" page. The code should be rewritten to use the "rs" variable rather than the path of the error document.
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6795
Location: Ha Noi, Viet Nam

PostPosted: Fri Mar 16, 2012 12:31 am Reply with quote

Not sure why you need to explicitly add the RewriteEngine On since it should already be on if using the default htaccess file
Are you actually using RN version 2.3 ??

Sorry I cannot help you more with this but I have never used this module, I use my own custom error documents.
 
View user's profile Send private message Send e-mail
n3pla







PostPosted: Tue Mar 20, 2012 6:35 am Reply with quote

I am using RavenNuke 2.5
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Tue Mar 20, 2012 6:58 am Reply with quote

I do agree that some installations (not very many actually) require the explicit turning rewrite on and fewer still need the base set to "/".

I'm with Guardian, that I do not use this feature as I really do not want the extra overhead of an actual module especially if I'm being pummeled with automated exploit checking tools. I prefer to log all the errors in a file and then once every few hours check to see if there is anything in that file, and if so, send the contents out in an email....

Edited: Forgot to mention that I also moved this thread into the 2.5 forum.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
n3pla







PostPosted: Tue Mar 20, 2012 7:02 am Reply with quote

One other thing every example I have seen of someone using .htaccess they added the two lines I used in my .htaccess file. Maybe "just in case" these lines were not added in the servers configuration, but for what ever reason I followed their example and it worked.

Once I examine the ErrorDocument module, I should be able to figure out how to rewrite the module to use the rs variable used by the 404 handling code. I will then change the error handlers in the .htaccess file for the other error codes so they also used the rs variable to send the correct data to the module.

Presently only the 404 error handing in the .htaccess file sets the rs variable in the URL that calls the ErrorDocument module. ErrorDocument module presently does not USE the rs variable. It is therefore necessary to modify both to have the ErrorDocument module display the proper data.

I remember using PHPNuke, and doing something similar with error handling code and .htaccess for that... would not be the first time I modded php to make things more suitable for my tastes.
 
Guardian2003







PostPosted: Tue Mar 20, 2012 10:08 am Reply with quote

n3pla wrote:

Note: I removed the 406 error simply because the server I am using gives me 5 html files that I could modify to make them look like my web site these are for the same 5 errors I chose to reflect in my htaccess. When I used the original code the 404 error did not function.

That is a little confusing.
If you want to use error pages provided by your hosting provider you should be doing something like
Code:
 

ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
... etc

As you know, ErrorDocument is Apache's htaccess command to intercept HTTP header response codes, followed by a space and the three digit error code, followed by another space and the url to forward to.

Code:


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /modules.php?name=ErrorDocuments&file=404&rs=$1 [NC,L,R]

Those three lines are a special case. Essential it takes the requested filename and adds it to the $1 variable in the rewrite rule so the Errordocument module can process the requested file name.

If you also have
Code:


ErrorDocument 404 /modules.php?name=ErrorDocuments
you should delete it as this will negate the previous rule and rewrite condition for processing a 404 header response code.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©