Forum Moderators: phranque
If you are getting lots of stuff logged in this file, check the setting of RewriteLogLevel [httpd.apache.org] in your server configuration files. It should normally be set to zero or set to a very low number to minimize mod_rewrite activity logging, and only set higher if you are actively debugging mod_rewrite problems on the server.
Sometimes, people will enable rewrite logging to test, and then forget to turn it off.
I assume that no-one has pointed some other logging function the same file, which could also happen.
Jim
It was writing everything, and writing to the default location of /var/log/httpd/https_rewrite_log file.
It was writing a gig a week so I set it to zero.
One last question...
recommended setting of UseCanconicalName
off? or on?
Jim
I am using some handfuls of "vanity domains" and generic domains to guide type-in traffic to my sites. In order to avoid duplicate content issues, there is some extensive rewriting at work. I always wanted to know exactly how much type-in traffic to those domains I actually get. The regular logfiles don't show this - they only log AFTER the rewriting has been done.
Would this directive help me get the requests PRIOR to rewriting? How would I configure it? I would not want to configure a virtual server for each to-be-rewritten-domain - that would somehow counteract the concept...
Could someone post a sample of this logfile?
Thanks!
> I would not want to configure a virtual server for each to-be-rewritten-domain - that would somehow counteract the concept...
I'm not sure what you mean by "counteract the concept" exactly, but consider setting up a virtual server for each domain, and the pointing them all to the same document_root. That way, you can log them separately, but serve the same content for all.
Jim
<VirtualHost *>
ServerName www.mysite.com
ServerAlias mysite.com
ServerAlias www.generic1.com
ServerAlias generic1.com
ServerAlias www.generic2.com
ServerAlias generic2.com
[... other virtual server setup code ...]
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.mysite\.com
RewriteRule (.*) http://www.mysite.com$1 [R=301,L]
</VirtualHost> So in the front section I declare responsibility for all the secondary domains, and the last rewrite-block rewrites anything to the proper URL.
However, if someone launches the browser to www.generic1.com, all I get in my logfiles are accesses to www.mysite.com. What I am looking for is a way to get some kind of logging of how many people actually tried to access generic1.com - and where they possible came from. That would enable me to use the domain name as a kind of "tracking parameter" in print advertising etc.
SetEnvIf HOST "^(www\.)?mysite\.com(:[0-9]{1,5})?$" Dom_mysite
SetEnvIf HOST "^(www\.)?generic1\.com(:[0-9]{1,5})?$" Dom_generic1
SetEnvIf HOST "^(www\.)?generic2\.com(:[0-9]{1,5})?$" Dom_generic2
SetEnvIf HOST "^(www\.)?generic3\.com(:[0-9]{1,5})?$" Dom_generic3
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" ExC_NCSA
#
CustomLog logs/mysite.log ExC_NCSA env=Dom_mysite
CustomLog logs/generic1.log ExC_NCSA env=Dom_generic1
CustomLog logs/generic2.log ExC_NCSA env=Dom_generic2
CustomLog logs/generic3.log ExC_NCSA env=Dom_generic3
So, the initial requests to each "generic" host will be logged to separate files. After your mod_rewrite code redirects these initial requests to mysite.com, those redirected requests will be logged to the mysite.com log.
See Apache mod_log_config [httpd.apache.org]
Jim
If it's not clear, an HTTP redirect response from your server terminates the current client request, and tells the client to re-request the desired resource from the server using the new URL provided in the redirect response. Therefore, if the first HTTP request is made to "generic1", it gets logged in the generic1 log file. If your mod_rewrite code then redirects that request to "mysite", then the resulting second HTTP request gets logged to the mysite log.
Jim