Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1166
  • Last Modified:

Bounce Rate and 301 Redirects

Hi,

I have a site that has multiple aliases set up in apache. I now have my htaccess set up to redirect all the aliases to the main site url, but I am still getting about 4000 referrals a day in my google analytics from the aliases but I don't understand why or how that is happening.

This is the apache setup
ServerName www.sitea.com
ServerAlias sitea.com www.siteb.com siteb.com www.sitec.com sitec.com www.sited.com sited.com www.sitee.com sitee.com

Open in new window


This is the .htaccess redirect
     RewriteEngine  on
     RewriteCond %{HTTP_HOST} !^www.sitea.com$ [NC]
     RewriteRule ^(.*)$ http://www.sitea.com/$1 [R=301,NC,L]

Open in new window


so this has been in place for 2 days. But I am still getting 3000+ referrals from http://sitea.com and ~1000 from all the others. This I believe is causing my bounce rate to be incorrect and higher than it should be.

Setting up this .htaccess dropped the bounce rate by 25% and the number of referrals from aliases is way down, but I don't understand why there are still so many coming through when they should be handled and redirected by the .htaccess.

Thanks for any help/info
0
jrm213jrm213
Asked:
jrm213jrm213
  • 7
  • 6
  • 5
2 Solutions
 
xtermCommented:
I'm trying to understand your terminology here - what do you define as "bounce rate"?  And when you say you're getting 3000+ referrals from http://sitea.com/ do you mean you're having 3000 unique 301 redirects via your .htaccess file (which previously would've simply showed up as unique visits to your main site, by way of ServerAlias)

Do I have this correct?
0
 
jrm213jrm213Author Commented:
Ok, so in google analytics it shows you where your traffic came from. According to google analytics 3000 visitors came from http://sitea.com  which because it is the same site, has the same google analytics tracking code. When you click a link on http://sitea.com it will take you to http://www.sitea.com which then records a bounce on google analytics because http://www.sitea.com and http://sitea.com are not the same url according to them.

A bounce according to my understanding is a person landing on your site and then leaving that site (fully qualified domain name) without visiting another page on that site (fully qualified domain name).

So your bounce rate is calculated by the number of visitors that bounced divided by the total number of  visitors you have received.

By 3000 referrals I mean 3000 visits started at http://sitea.com and then went to http://www.sitea.com, so http://sitea.com was the referrer for that traffic.

I thought that http://sitea.com should no longer reach the browser because it gets 301 redirected by the .htaccess file, and the browser only ever sees http://www.sitea.com
0
 
PapertripCommented:
Perhaps the referrals are coming from subdirectories such as http://sitea.com/other/dir and it's not using the .htaccess from the root but ServerAlias instead?

Instead of using .htaccess, can you put it inside your VirtualHost config block?

Also I modified the syntax a bit
     RewriteEngine  on
     RewriteCond %{HTTP_HOST} !^www.sitea.com$ [NC]
     RewriteRule ^(.*)$ http://www.sitea.com%{REQUEST_URI} [R=301,NC,L]

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
PapertripCommented:
Hey xterm, what do you think about request_uri vs $1

Sent from mobile
0
 
xtermCommented:
@Papertrip:
I'm not sure what difference that makes - the two rules look identical to me, just written in a different way.
Also, putting it in VirtualHost vs. .htaccess also doesn't make it operate any differently.

I'm not really clear on why you suggested either.

BTW, ServerAlias doesn't result in a 301 - it just loads the URL as the client requested it.  If the client goes through the RewriteRule, their URL window will literally change, and it will result in 2 hits to the webserver instead of the 1 that would result from ServerAlias.
0
 
PapertripCommented:
I'm not sure what difference that makes - the two rules look identical to me, just written in a different way.
When I supplied the original RewriteRules to the Asker, I said to use $1.  During my testing I noticed that retrieving files directly under the root would add an additional / to the URL, like http://domain.com//robots.txt.  Does that work, sure.  Did it annoy me, yes.  I did further research and read up on REQUEST_URI and my tests came back with only 1 / after HTTP_HOST.

Also, putting it in VirtualHost vs. .htaccess also doesn't make it operate any differently.
I didn't think it would make a difference either, which is why there are question marks in my answer and the word "perhaps".  I do know however that putting it in VirtualHost will work for all subdirectories of www.sitea.com, so I wanted him to test it out.   If you know why he is still seeing referrals from the redirected 301, by all means let us know.

BTW, ServerAlias doesn't result in a 301 - it just loads the URL as the client requested it.  If the client goes through the RewriteRule, their URL window will literally change, and it will result in 2 hits to the webserver instead of the 1 that would result from ServerAlias.
I realize that, that is why he now has a RewriteRule for a 301.

I was simply asking you your thoughts on REQUEST_URI vs $1.
0
 
xtermCommented:
$1 is the same thing as REQUEST_URI in a rewrite

And RewriteRule traverses subdirectories regardless of whether its in htaccess or in httpd.conf in a VirtualHost directive.

@jrm213jrm213
> I thought that http://sitea.com should no longer reach the browser because it gets 301 redirected by the .htaccess file, and the browser only ever sees http://www.sitea.com

This is not technically accurate.  A visitor to sitea.com will still generate a blip on sitea.com (ie. you will see the browser info in the logs)  and then after the redirect, it will go to www.sitea.com and result in a second hit.

So you say you're "still" getting 3000 hits a day from sitea.com but does that match the number of total 301s?

My point is, I'm not clear on what number you EXPECT the bounce rate to drop by simply by virtue of the fact that users are now starting at www.sitea.com where they belong after the 301s.  Does that make sense how I'm wording it?
0
 
jrm213jrm213Author Commented:
Hi,

well, I guess this was my thinking

browser requests http://sitea.com 
server receives and logs request
server reads .htaccess and says you don't belong here
server redirects browser to http://www.sitea.com using 301
browser requests http://www.sitea.com
server receives and logs request
server reads .htaccess and is happy
server supplies index.php of http://www.sitea.com
browser receives and process result of index.php
browser executes javascript that updates google analytics
google analytics notes a viewer has viewed http://www.sitea.com

In this scenario google analytics should not notice that people are going to http://sitea.com at all.

So even though the user generates a blip on the server log, Google analytics should never see it.


0
 
PapertripCommented:
So even though the user generates a blip on the server log, Google analytics should never see it.
Correct.

Check out this thread, a lot of solid info and some helpful tips.

Bounce rate really has nothing to do with this.
0
 
xtermCommented:
Interesting, so the search engines just need time to recrawl the site and then they'll update their internal DBs with the target of the 301, and the referrals will drop according to those comments - nice find Papertrip.
0
 
jrm213jrm213Author Commented:
Ok, so that is what I thought, I don't understand how I am still getting visitors to http://sitea.com that are then visiting my site, showing in my analytics as

referral traffic from http://sitea.com

0
 
jrm213jrm213Author Commented:
for example yesterdays traffic report

Sources                                 Visits                   % visits
(direct) ((none))                    9,481                   48.01%
google (organic)                    4,961                   25.12%
sitea.com (referral)                3,949 	          19.99%
bing (organic)                           238 	                    1.21%
facebook.com (referral)            213                      1.08% 

Open in new window

0
 
xtermCommented:
That link seemed to indicate that for whatever reason, Google Analytics treats those 301s as referrals even though they're technically not.
0
 
jrm213jrm213Author Commented:
The reason I am asking about bounce rate in this scenario is

If referrer was sitea.com then google analytics tracked it as a bounce when it went to www.sitea.com because the are the same site and have the same analytics tracking code.
0
 
PapertripCommented:
Give it some time for the old links to expire from cache.  What does today's report look like?

Just relax and let the internet do it's thing ;)
0
 
PapertripCommented:
I don't know any more about GA bounce rate.  I really think you should just give it another day or so and check the stats then.  You put in a proper 301 fix to your original problem, be happy about that.  What's the rush?
0
 
jrm213jrm213Author Commented:
No rush really other than people at work keep asking me about it. I will give it some time, I just didn't understand how traffic could still be reporting it as a referrer when the server doesn't let it serve pages from that url.

Will give it some time.

0
 
jrm213jrm213Author Commented:
My answer that I accepted as part of the solution is to show the steps that I believed happened in the recording of the analytics. The answer by Papertrip pointed me to a resource that confirmed and expanded on it.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 7
  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now