Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



SEO Class in Chicago, IL

Learn How To Optimize Your Website on July 26, 2013


Looking for personalized in-depth SEO training among your peers?



High Rankings is offering a 1-day customized SEO training class in Chicago. Class size is limited so please sign-up now if you want in!



 


Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Www.site.com To Site.com


  • Please log in to reply
11 replies to this topic

#1 DianeV

DianeV

    HR 4

  • Active Members
  • PipPipPipPip
  • 166 posts
  • Location:Los Angeles

Posted 20 October 2003 - 02:51 AM

Okay, I bow to the wisdom of the gods of serverdom.

Question: I've enabled both www.site.com and site.com (FreeBSD/Apache). While I can do this:

Redirect 301 /oldpage.html http://site.com/newpage.html

I'm wondering how/whether I can redirect www.site.com to site.com.

Yes, I've worked out a way that apparently sends the server in loops (nothing much happens, but boy does it crank!), but can't work out how and whether I can do this.

#2 csjavi

csjavi

    HR 4

  • Active Members
  • PipPipPipPip
  • 148 posts
  • Location:Tampere, Finland

Posted 20 October 2003 - 04:29 AM

Try something like this. I don't have access to my server from this office, so I can't check the exact syntax. There is probably a typo in there somewhere. :thumbup:
RewriteCond %{ HTTP_HOST} !^site\.com$ 
RewriteRule ^(.*) http://site.com/$1 [R,L]

That translates to something like:
For every page request where domain isn't site.com, redirect to corresponding page on site.com.
That takes care of multiple domains and subdomains. If you only want to direct from www.site.com to site.com, then try this.
RewriteCond %{ HTTP_HOST} ^www\.site\.com$ 
RewriteRule ^(.*) http://site.com/$1 [R,L]


#3 SEOCub

SEOCub

    HR 4

  • Active Members
  • PipPipPipPip
  • 122 posts
  • Location:LSD, Chicago

Posted 20 October 2003 - 12:49 PM

I found this over the weekend:
http://www.ihelpyous...&threadid=11760

I think that dropping the www from the last line of the suggested code would make the www URL redirect to non-www and the non-www stay the way it is.

#4 DianeV

DianeV

    HR 4

  • Active Members
  • PipPipPipPip
  • 166 posts
  • Location:Los Angeles

Posted 20 October 2003 - 01:18 PM

Okay, thanks. It looks like mod rewrite is the only way to go.

I'd been hoping for a solution via the server configuration file, but that just sends it in loops, as far as I can tell.

Thanks, all!

#5 Bowdii

Bowdii

    HR 1

  • Members
  • Pip
  • 2 posts

Posted 20 October 2003 - 01:35 PM

symbalic link will do this perfect

under the dir

/user/local/www/data/

ln -s www.domain.com domain.com


Thats it!

#6 Ron Carnell

Ron Carnell

    HR 6

  • Moderator
  • 959 posts
  • Location:Michigan USA

Posted 20 October 2003 - 02:15 PM

"Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo." Brian Moore Apache Documentation

Mod_rewrite will definitely do the trick. Fact is, mod_rewrite will do just about ANY trick. Use the right parameters, and the lil puppy can probably be trained to cook breakfast for you every morning. Trouble is, use the wrong parameters and your eggs just might be laced with cyanide. :naughty:

The code csjavi posted is really close, with one potential problem and one definite problem. The potential problem is the forward slash before the regex parameter ($1). I "think" the parameter will already contain a leading slash, but I'd have to play with it to be sure. The definite problem is that, by default, mod_rewrite is going to perform a 302 Redirect, which isn't what you want. Use the [R] parameter to set it to a 301. Should look something like this (untested, so be wary):

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule ^(.*)$ http://www.mydomain.com$1 [R=301,L]

And, Diane? These mod_rewrite commands CAN be placed in your httpd.conf file, so you needn't give up that hope on that count. :D

In my opinion, however, mod_rewrite is over-kill for a job this simple. It carries too much server overhead and, frankly, I would always be a little worried about that cyanide.

Put this single line in the <VirtualHost> block for your www domain, and it will do pretty much the same thing as the mod_rewrite directives did:

RedirectMatch 301 (.*) http://mydomain.com$1

That RedirectMatch command, of course, is presupposing that you have configured httpd.conf with TWO separate <VirtualHost> blocks, one for domain.com and one for www.domain.com. That seems to be the way most people I've talked to recently are doing it. And, uh, in my opinion, it might just be the wrong way. Take a look at this simplified configuration:

<VirtualHost 217.7.165.70>
DocumentRoot /home/highrankings/www
ServerName highrankings.com
ServerAlias www.highrankings.com
</VirtualHost>

(This configuration assumes, of course, that DNS is properly configured and both domain.com and www.domain.com point at 217.7.165.70)

For the past few years, I was convinced that Google was smart enough to automatically merge the PR for domain.com and www.domain.com, because that's what was happening on all my domains. I have only recently learned that others in this forum were configuring www differently than I have been doing, so I'm still testing, but can at least describe some of my preliminary results.

If you configure domain.com and www.domain.com in separate <VirtualHost> blocks, Google doesn't automatically merge backlinks. Ergo, you need to incorporate a 301 Redirect.

If you try to use extended versions of the ServerAlias directive, backlinks again are not automatically merged. For example, ServerAlias *.domain.com and ServerAlias www.domain.com ww.domain.com wwww.domain.com both create aliases, but do not merge PR.

In every single instance I've tested, the simplified directive ServerAlias www.domain.com has resulted in an IDENTICAL listing of backlinks for both domain.com and www.domain.com.

My tests have only been running for two weeks (since I discussed this with Compar in a thread here), and are definitely preliminary. I want to test a few other configurations, and it'll be a month or two before I can be confident these early results will hold true. In short, Caveat Emptor. :D

Hope this helps, Di.

#7 DianeV

DianeV

    HR 4

  • Active Members
  • PipPipPipPip
  • 166 posts
  • Location:Los Angeles

Posted 22 October 2003 - 06:57 AM

Ron, thanks for the data. It took me a while to read it. ;-)

My domains are configured in one block in the httpd.conf, so it looks like I don't have to do anything if backlinks are calculated together.

Interestingly (and perhaps I'm not doing this right), Google shows different results for link:www.mysite.com and link:site.com -- but the same number if the domain name is preceded by the http://.

Thanks, Ron. I'll be interested to hear the results of your testing. And thanks for the excellent explanation (as usual).

#8 DianeV

DianeV

    HR 4

  • Active Members
  • PipPipPipPip
  • 166 posts
  • Location:Los Angeles

Posted 22 October 2003 - 07:35 AM

Oops -- csjavi, I appreciate your input too!

#9 nedesign

nedesign

    HR 2

  • Active Members
  • PipPip
  • 18 posts

Posted 22 October 2003 - 02:30 PM

"Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo." Brian Moore Apache Documentation

Mod_rewrite will definitely do the trick. Fact is, mod_rewrite will do just about ANY trick. Use the right parameters, and the lil puppy can probably be trained to cook breakfast for you every morning. Trouble is, use the wrong parameters and your eggs just might be laced with cyanide. ;)

The code csjavi posted is really close, with one potential problem and one definite problem. The potential problem is the forward slash before the regex parameter ($1). I "think" the parameter will already contain a leading slash, but I'd have to play with it to be sure. The definite problem is that, by default, mod_rewrite is going to perform a 302 Redirect, which isn't what you want. Use the [R] parameter to set it to a 301. Should look something like this (untested, so be wary):

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule ^(.*)$ http://www.mydomain.com$1 [R=301,L]

And, Diane? These mod_rewrite commands CAN be placed in your httpd.conf file, so you needn't give up that hope on that count. :)

In my opinion, however, mod_rewrite is over-kill for a job this simple. It carries too much server overhead and, frankly, I would always be a little worried about that cyanide.

Put this single line in the <VirtualHost> block for your www domain, and it will do pretty much the same thing as the mod_rewrite directives did:

RedirectMatch 301 (.*) http://mydomain.com$1

That RedirectMatch command, of course, is presupposing that you have configured httpd.conf with TWO separate <VirtualHost> blocks, one for domain.com and one for www.domain.com. That seems to be the way most people I've talked to recently are doing it. And, uh, in my opinion, it might just be the wrong way. Take a look at this simplified configuration:

<VirtualHost 217.7.165.70>
DocumentRoot /home/highrankings/www
ServerName highrankings.com
ServerAlias www.highrankings.com
</VirtualHost>

(This configuration assumes, of course, that DNS is properly configured and both domain.com and www.domain.com point at 217.7.165.70)

For the past few years, I was convinced that Google was smart enough to automatically merge the PR for domain.com and www.domain.com, because that's what was happening on all my domains. I have only recently learned that others in this forum were configuring www differently than I have been doing, so I'm still testing, but can at least describe some of my preliminary results.

If you configure domain.com and www.domain.com in separate <VirtualHost> blocks, Google doesn't automatically merge backlinks. Ergo, you need to incorporate a 301 Redirect.

If you try to use extended versions of the ServerAlias directive, backlinks again are not automatically merged. For example, ServerAlias *.domain.com and ServerAlias www.domain.com ww.domain.com wwww.domain.com both create aliases, but do not merge PR.

In every single instance I've tested, the simplified directive ServerAlias www.domain.com has resulted in an IDENTICAL listing of backlinks for both domain.com and www.domain.com.

My tests have only been running for two weeks (since I discussed this with Compar in a thread here), and are definitely preliminary. I want to test a few other configurations, and it'll be a month or two before I can be confident these early results will hold true. In short, Caveat Emptor. :)

Hope this helps, Di.

Ron~ I was wondering if you had any more conclusions concerning this?

You seem to be good at this type of stuff and I am in need of some help.

Please take a look at the following thread to see if you have anything to add: http://www.highranki...t=0

Thanks,

Aaron

#10 Ron Carnell

Ron Carnell

    HR 6

  • Moderator
  • 959 posts
  • Location:Michigan USA

Posted 22 October 2003 - 02:55 PM

There's really nothing to add, Aaron, beyond what was previously said.

There is overwhelming evidence, including comments from Google (albeit cryptic ones), to suggest that a 301 Redirect in any of its various permutations will merge the PageRank for two sites. The only thing you have to decide is which of the various ways of returning a 301 status will work best for your situation.

#11 nedesign

nedesign

    HR 2

  • Active Members
  • PipPip
  • 18 posts

Posted 22 October 2003 - 02:58 PM

redirectpermanent /index.html http://www.ne-design.net/index.htm (via .htaccess file)?

Thanks Ron for dropping in!

-Aaron

#12 nedesign

nedesign

    HR 2

  • Active Members
  • PipPip
  • 18 posts

Posted 22 October 2003 - 07:46 PM

Lame Google response as expected: :)

Hi Aaron,

Thank you for your note. Due to the tremendous volume of information and help requests we receive from webmasters, we're not able to provide personal responses to individual emails.

However, we want webmasters to be informed about our policies and procedures. To that end, we've dedicated an entire section of our site to answering the most common questions from those who maintain and/or promote websites. You'll find all of our publicly available information posted at www.google.com/webmasters/index.html.

Besides this section of our site, we've created a newsgroup discussion forum for passionate Google users. At http://groups.google.com in the http://groups.google...support.general
group, many webmasters and Google users share their questions, frustrations, and expertise.

We recommend doing an advanced search on this group if you feel your question is particularly challenging and you've been unable to find an answer on our site. (Please note that this is an English-language
newsgroup.) Go to http://www.google.co...up_search?hl=en and enter your search terms in the "find messages" fields at the top of the page in the yellow highlighted section. Once you've entered your search terms, enter "google.public.support.general" into the "newsgroup" search field. Click on "search" and check the results. If you don't find an answer to your question, you can always post your question to the group and see if other newsgroup users have helpful advice to offer.

Regards,
The Google Team




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users