Redundant Hostnames

C5rider

Participant
Joined
Jun 3, 2016
Messages
58
Google Analytics is reporting that my site is getting redundant hostnames (bench-racer.com and www.bench-racer.com). I see that this is a common problem and the solution is a 301 redirect.

That's all fine and well, but being a newb, what IS (or better yet, how do you DO) a 301 redirect. I've pulled some info, which probably make perfect sense for most folks here, but I'm on a steep learning curve. Even so, I enjoy learning, so I'm trying to figure out how, or what to do for a 301 redirect.

Here's what I THINK I know:

To fix the problem, simply add the following to a .htaccess file at the root of your site:

RewriteEngine On # This line may already exist # Rewrite all requests to the 'www' version
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^.*$ http://www.mydomain.com%{REQUEST_URI} [R=301,L]

Now. first off, am I to assume that mydomain\.com should be bench-racer\.com and www.mydomain.com should be www.bench-racer.com ? Leave all the additional code symbols intact?

Secondly, where do I find my .htaccess file at the root of my site?

I apologize if this is so elementary. But it's so new. I'm learning more every day, but some days, the waters are pretty deep. Any help is appreciated.

Thoughts?
 
Top