Couple of Questions about .htaccess

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nexcom28
    So Fucking Banned
    • Jan 2005
    • 3716

    #1

    Couple of Questions about .htaccess

    If you know the answer to either of these, please can you share..

    1. Using .htaccess can I determine a referral domain and send the visitor to a site depending on site.
    For example;
    If Site A then redirect mysite3.com
    If Site B then redirect mysite1.com
    If site C then redirect mysite 2.com

    2. I have domains that redirect to my main site and they receive traffic in their own right. Currently the sites 301 redirect using .htaccess however I would like to anayze the traffic from these domains, what is the best way to do this? (before it hits my main site)
  • Juicy D. Links
    So Fucking Banned
    • Apr 2001
    • 122992

    #2
    Code:
    RewriteCond %{HTTP_REFERER} \.SITEINHERE\. [NC,OR]
    RewriteRule . mysite1.com [L]



    Someone just check the syntax for me

    Comment

    • freecartoonporn
      Confirmed User
      • Jan 2012
      • 7683

      #3
      1. yes

      1st make sure which redirected you wanna use 301/302

      then use google for code and use it.

      2. how do you want to analyze the traffic ?
      if you want your script to analyze then your best bet would be send all traffic to index.php and make the php do the redirection.. instead of htaccess
      SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean

      Comment

      • Why
        MFBA
        • Mar 2003
        • 7230

        #4
        something like this should work:

        Code:
        RewriteCond %{http_referer} ^http://([^.]+.)*(somesite).com
        RewriteRule ^$ ?ref=somesite.com [R=302,L]
        then you can attach a variable to the end of the request. hook that into whatever analytics system you are already using.

        Comment

        • MichaelP
          Registered User
          • Aug 2003
          • 7123

          #5
          Originally posted by Why
          something like this should work:

          Code:
          RewriteCond %{http_referer} ^http://([^.]+.)*(somesite).com
          RewriteRule ^$ ?ref=somesite.com [R=302,L]
          then you can attach a variable to the end of the request. hook that into whatever analytics system you are already using.
          Hum Useful,. Txs for sharing

          Comment

          Working...