What would cause RewriteRule not to work?

Hello Experts,

I have a really frustrating dilema I am facing here.  I have two almost completely identical websites, I know they are almost completely identical because all I did was copy the files and the database from one site into the domain of the other and update any references to the domain.  Even the domains are almost exactly the same, just one is a .com and the other is a .org.  Each site sits on its own server, and a minor modification was made to one server's .htaccess to allow for password protection (since this is a development site).

Well, as I said, the .htaccess files are identical with the exception of the updated domain name and the password protection, but for some reason, only some of the rewrite rules and conditions seem to be working.  The others don't seem to be taking any effect.

What could cause only some rewrite rules to work, especially since they are proven to work on the other server?  I've already checked the apache configuration files and there are no rewrite rules there, but apache is properly configured to use rewrite rules.
LVL 17
Who is Participating?
OmniUnlimitedConnect With a Mentor Author Commented:
Unfortunately, the check the log methods described were not practical for me.  I ended up calling technical support on my server and describing the fact that the site that operates perfectly fine on one server will not on the other.  The technician was able to correctly ascertain that there were differences in the setup of the two servers, specifically, the installation of a CPanel on the server giving the problems.  We replaced the CPanel with a Plesk system (as we have it on our other server) and the site works fine.
Turn on logging for rewrite rules.  That will give you some clue.  The most likely reason is that the original condition pattern is not being met (most likely because it has some domain component in it).
OmniUnlimitedAuthor Commented:
OK, have patience with me because for the most part, this is all new to me.  I did not write the rewrite rules, nor do I know how to do it, nor how the files are supposed to be configured for it other than stuff I found online.  I read in the Apache documentation that I can turn rewrite rule logging on, but that i should be careful as to how high I set it because it can dramatically slow down the processes.

Question 1: How high a level do you recommend I set RewriteLogLevel?

Question 2: Once it starts logging, where on the server can I find the log?

Thanks again.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Steve BinkCommented:
The RewriteLog is very useful, but it can also generate a lot of information, and you will see a minor performance hit on each request.  You should definitely not keep it on in production environments.  Turning it on momentarily for debugging rules is fine, though.

When you need the log for debugging, set the RewriteLogLevel at 9.  The RewriteLog directive determines where the log file will be generated.

Note that the RewriteLog and RewriteLogLevel directives must be placed in the server's main conf file, or in the site's VirtualHost container.  They will not function within htaccess files.  

If you can turn on your log, and post a single attempt of a rule not working, we can assist in debugging.  Posting the full set rules you are using will be helpful also.
OmniUnlimitedAuthor Commented:
Hi, sorry it took so long to get back to you.  I had to try and generate the log at a time when there was least traffic on the production site.  Even when I did that, the file (for only a couple of minutes of activation) exceeded 4 MB in size.  I am aghast.  I activated the logs, accessed one page that I knew I was having differences in resulting url's on between the two sites, then deactivated the log.  The one on the development site (the one with no traffic) produced a file 1.67 MB in size.

I'm sorry, but I don't have the time to go over these logs line by line, especially considering the fact that 1) I do not know how to interpret them, and 2) I do not know precisely what it is I am looking for.

The .htaccess file has dozens of rewrite rules and conditions within it.  What is the most time efficient method of locating my problem?
Steve BinkCommented:
I am not aware of any shortcuts to this process.  You need to identify which rule is not applying, and why.  The only place you'll find this information is in the rewrite log, and there is not going to be a big, bold sign pointing the way.   Even worse, there could be multiple rules failing in some way, or multiple rules just not playing well together.

The easiest way to do this on a production server is to trigger the failure from a specific client IP, then isolate just that IP from the rewrite log.  Depending on how many rules your request is testing, you could still end up with a sizable log to go through, but it should be much better than the megabyte range you are currently seeing.
post the rewrite rules and any information you have regarding which rules do and do not work.

it may be easy for us to figure out by simply seeing the file, or we can point out more precise usage of the rewrite log. btw, log level 2 is reasonably easy to understand and provides decent debug info in most cases. it is difficult to work with the rewrite log on a production server
OmniUnlimitedAuthor Commented:
Sorry, none of the suggestions offered provided a practical solution to my problem.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.