php - How to log every single access to my website with 2 different domains -


I have two different domains that both point to my homepage in the same server.

I want to log in to each entry on my homepage and login to know which domain I used to access my homepage, how can I do this?

I tried mod_rewrite in apache and entered a mysql database with php but all i have is infinite loop.

Any thoughts?

Edit:
From your reply, I see that I did not find what I want ..

As far as I know that Google Analytics does not allow me to differentiate the domain, if they both point to the same site and also see this to me Does not allow that some files like images were directly accessed instead of my webpages.

I just can not use the $ _SERVER ['HTTP_HOST'] reason as I said now, I want to log everything, such as images and all other files, every single request, even if it exists Not in

For Webalizer, I have never seen that this difference is in the domain, it always configures the default domain in the account and uses it as root, it does not even display it to me It has to be checked again, but I'm not sure it will work which I want ...

Eternal Lup: A simple revetting rule pointing to the PPP script With URL in expected, PHP script one Logging the entry into the MySQL database and sending the user back to the file with the header () function. Something like this:

.htaccess:

  rewrite %% {HTTP_HOST} ^ (www \.)? Domain1 \ .net [NC] rewrite rule ^ (. *) $ Http: //www.domain1.net/logscript?a=$1 [NC, L] rewritecode% {HTTP_HOST} ^ (www.)? Domain 2 \. Net [NC] Reutersell ^ (. *) $ Http://www.domain2.net/logscript?a=$1 [NC, L]  

PHP Script:

  $ url = $ _GET ['A']; $ Domain = $ _SERVER ['HTTP_HOST']; // Code to enter MySQL database header ("location: http: // $ domain / $ url"); Go out();  

So, I use some file, pointing to that script on PHP script and logging the script and redirecting to that file ... However, when PHP is in that file Redirects, then the HTX rules will pick it up and again redirect PHP scripts, which make infinite loops.

The best thing is to parse the server log. They will show the domains and requests. Even the most shared hosting accounts provide access to logs.

If you are going on the rewriting route, then you use RewriteCond for HTTP_REFERER to see if the referrer is a local link Was it or not?

  rewrite% {HTTP_HOST} ^ (www \.)? Domain 1 \ .net [NC] rewrite% {HTTP_REFERER}! ^ (. *) Domains 1 (. *) $ [Nc] Riverify ^ (. *) $ Http://www.domain1.net/logscript?a=$1 [NC, L] RevertCand% {HTTP_HOST} ^ (. *) Domain2 \ .net [NC] RevokedContact% {HTTP_REFERER}! ^ (. *) Domain2 (. *) $ [Nc] rewritable ^ (. *) $ Http://www.domain2.net/logscript?a=$1 [NC, L]  

You may also want to post in the forum. They have a complete section about managing the domain.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -