Apache: Where to examine the redirection logs?

Posted on

Apache: Where to examine the redirection logs? – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, mod-rewrite, rewrite, , .

I have complicated RewriteCond and RewriteRule in one machine. And according to these rules, some of the requests will be redirected to another machine.

So is there any Apache log that shows clearly how the redirection takes place? Because the redirection is happening in the ways that I don’t anticipate.

For the uninitiated, this is how you should write your *.conf file:

  NameVirtualHost *:80
  <VirtualHost *:80 >
    ServerName gw.myserver.net
    DocumentRoot "C:Program FilesMyCompanymyserverWeb"
    DirectoryIndex index.html index.php
    RewriteLog "logsrewritelog.txt"
    RewriteLogLevel 3
    <Directory  "C:Program Files MyCompany myserverWeb">
       AddDefaultCharset UTF-8
       Order Deny,Allow
       Allow from all

       RewriteEngine on
       RewriteBase /
       RewriteCond %{HTTP_HOST}   ^gw. myserver.net$
       RewriteRule !^(login|index.php)  http://pmmenu. myserver.net%{REQUEST_URI}$1 [L,R=301]
       # we check if the .html version is here (caching)
       RewriteRule ^$ index.html [QSA]
       RewriteRule ^([^.]+)$ $1.html [QSA]
       RewriteCond %{REQUEST_FILENAME} !-f

       # no, so we redirect to our front web controller
       RewriteRule ^(.*)$ index.php [QSA,L]

You need to enable the rewrite log in your virtual host or server config

RewriteLog "/usr/local/var/apache/logs/rewrite.log"

see http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog

You can configure a logfile specifically for Rewrite processing with the RewriteLog directive. The amount of logging can be selected with RewriteLogLevel.

Leave a Reply

Your email address will not be published. Required fields are marked *