iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Search Engine Optimization Forum SEO is much easier with help from peers and experts! The WebProWorld SEO forum is for the discussion and exploration of various search engine optimization topics. Any non (engine) specific SEO or SEM topics should go here.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-30-2005, 01:09 AM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default How do I redirect http:// to http://www.

I need a little help here. My directory is being indexed two ways...not good. Yahoo lists my site as http://top-affiliate.com and google indexes it as http://www.top-affiliate.com

I want all the search engines to index my site as http://www.top-affiliate.com

How do I do this and make sure all the search engines update their listings? What the best way. A .htaccess redirect or a meta?

If you could post the exact code for the best way that would be very helpful.
Reply With Quote
  #2 (permalink)  
Old 06-30-2005, 01:16 AM
WebProWorld MVP
WebProWorld MVP
 
Join Date: Jul 2004
Location: Omaha
Posts: 2,714
brian.mark RepRank 3brian.mark RepRank 3
Default Best way I know of...

Since you asked about .htaccess, I am assuming you're using Apache. The best way I know to handle this is by editing your httpd.conf file with the following:

Code:
<VirtualHost 12.109.80.231:80>
ServerAlias toolpartsdirect.com
Redirect permanent / http://www.toolpartsdirect.com/
</VirtualHost>
With that code, if you go to http://toolpartsdirect.com/, you'll notice your address bar changes to include the www when the 301 redirect is passed back.

If you don't have that much access on your server, then I'm not sure how to best handle it. .htaccess would affect both www and non-www (unless you have them hosted in different directories, which may be an option), so you'd be redirecting in an infinite loop from my understanding.

Brian.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies
Reply With Quote
  #3 (permalink)  
Old 06-30-2005, 01:27 AM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

Thanks for the quick response. However is the httpd.conf supposed to be in the root directory? Not familiar with this specific type of redirect. I need to redirect about 7K pages
Reply With Quote
  #4 (permalink)  
Old 06-30-2005, 01:37 AM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

Would something like this work on my index.php page?

Code:
<?php 
////////////////////////////////// 
// retrieving the server host name 
if (preg_match("/^.(.*?)$/i", $_SERVER["HTTP_HOST"], $serverName)) { 
// issue a seo friendly 301 redirect 
header("HTTP/1.1 301 Moved Permanently"); 
// redirect target 
header("Location: http://www.top-affiliate.com". $serverName[1] . $_SERVER["REQUEST_URI"]); 
exit(); 
} 
////////////////////////////////// 
?>
I'm not sure I wrot this write if someone could check it that would be great.
Reply With Quote
  #5 (permalink)  
Old 06-30-2005, 01:38 AM
WebProWorld MVP
WebProWorld MVP
 
Join Date: Jul 2004
Location: Omaha
Posts: 2,714
brian.mark RepRank 3brian.mark RepRank 3
Default http.conf

To put it simply, httpd.conf is the apache configuration file. Ours is in /etc/httpd/conf/ and it requires administrator (root level) access, although this change could also be done by editing some included files (httpd.inc) that are in the conf directory of each domain's webspace. Since each type of control panel handles things differently, it is tough to say for sure where your particular files will be found.

Also, after these changes are done, you need to restart Apache.

Brian.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies
Reply With Quote
  #6 (permalink)  
Old 06-30-2005, 01:40 AM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

Nope, that particular code did not work but it has to be close to being correct......
Reply With Quote
  #7 (permalink)  
Old 06-30-2005, 01:47 AM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

brian.mark:
Ahh I see. Unfortunately I don't have root (SSH) access to the server. I contacted my Web host so we'll see what they say. TY for your help though.
Reply With Quote
  #8 (permalink)  
Old 06-30-2005, 01:48 AM
Ne0's Avatar
Ne0 Ne0 is offline
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Jan 2004
Location: the intertubes
Posts: 509
Ne0 RepRank 4Ne0 RepRank 4Ne0 RepRank 4
Default do you have Cpanel 10?

Do you have Cpanel 10? That's what I use for all of my sites and I would just go to the control panel www.yoursitename.com/cpanel and click on redirects and make a permanent redirect for http:// --> http://www.
my $0.02
NeO1
__________________
I can levitate birds.... No one cares...

Top SEO Consultants |SEO 101
Reply With Quote
  #9 (permalink)  
Old 06-30-2005, 01:53 AM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

That's a nice feature of cPanel. I'm very happy with my web hosting CP but it does not provide that function unfortunately.
Reply With Quote
  #10 (permalink)  
Old 06-30-2005, 05:57 AM
jawn_tech's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2004
Location: USA
Posts: 1,546
jawn_tech RepRank 3jawn_tech RepRank 3
Default

Just simply use a Rewrite.

Create an .htaccess file (with notepad, in case you don't already have one). Use the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yoursitename.com$
RewriteRule ^(.*)$ http://www.yoursitename.com/$1 [R=301,L]

Upload to your parent directory, wherever your page files are stored. That should do it.

Don't forget to replace "yoursitename" with your domain name.
__________________
Domain Name Registration and Website Hosting :: DesignerTrade
Reply With Quote
  #11 (permalink)  
Old 06-30-2005, 07:20 AM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

Using that code returns my pages as http://www.top-affiliate.com/index.php?req=cat&id= and takes away all of my PR.
Reply With Quote
  #12 (permalink)  
Old 06-30-2005, 11:55 AM
WebProWorld Member
 
Join Date: Jan 2005
Posts: 47
Sapphire RepRank 0
Default

Stephen, just use the reverse version:

Quote:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^bluemushrooms\.com$
RewriteRule (.*) http://bluemushrooms.com/$1 [R=301,L]
And that'll make it no www. I use this on all my sites, and it's working fine. If I enter my sites with a "www" in the url, the url in the window immediately changes to have no www, and the site loads, and Google & Pals are only indexing the non-www version.
__________________
NEW! ChillyCool Web Digger SEO-friendly directory, no recip required
Get Rich Online in 387,923 Painful, Difficult Steps
Reply With Quote
  #13 (permalink)  
Old 06-30-2005, 04:25 PM
jawn_tech's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2004
Location: USA
Posts: 1,546
jawn_tech RepRank 3jawn_tech RepRank 3
Default

StephenR do you have any way of knowing who is linking to your site as the non-www version? I had the same issue and found a couple ibl sources who linked to me without the www . After contacting them they were willing to change the url in the link to add 'www'. For me I used the code above and it worked perfectly, and kept my PR. I don't have any dynamic pages though currently on the site I used it for, so maybe that's why. Also double check to ensure all internal links use www , or whichever version you end up going with.

Interesting, my experience was the opposite... google listed the http version and the others listed the www verion.
__________________
Domain Name Registration and Website Hosting :: DesignerTrade
Reply With Quote
  #14 (permalink)  
Old 06-30-2005, 05:44 PM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

I fixed it with a .htacess redirect. Good point with the IBL's...I have a lot of them though so it will take some time to identify the ones that need updating. Thanks for all the help gentleman.
Reply With Quote
  #15 (permalink)  
Old 06-30-2005, 06:15 PM
jawn_tech's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2004
Location: USA
Posts: 1,546
jawn_tech RepRank 3jawn_tech RepRank 3
Default

StephenR. that's great news you have a solution that works. I've tried 301 redirects but was getting loops when clicked on from an SE (with a timeout error), or else the pr didn't transfer. I'm curious how it was written, if you ever get a chance.

Best regards!
__________________
Domain Name Registration and Website Hosting :: DesignerTrade
Reply With Quote
  #16 (permalink)  
Old 06-30-2005, 07:22 PM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

Code:
RewriteCond %{HTTP_HOST} ^top-affiliate.*
RewriteRule ^(.*) http://www.top-affiliate.com/$1 [R,L]
All PR followed just fine.
Reply With Quote
  #17 (permalink)  
Old 06-30-2005, 10:50 PM
jawn_tech's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2004
Location: USA
Posts: 1,546
jawn_tech RepRank 3jawn_tech RepRank 3
Default

Ok cool. I see what you did.

Congratulations! Nice getting something resolved finally, isn't it.

:)
__________________
Domain Name Registration and Website Hosting :: DesignerTrade
Reply With Quote
  #18 (permalink)  
Old 06-30-2005, 11:00 PM
WebProWorld MVP
WebProWorld MVP
 
Join Date: Jul 2004
Location: Omaha
Posts: 2,714
brian.mark RepRank 3brian.mark RepRank 3
Default Nice.

Quote:
Originally Posted by StephenR.
Code:
RewriteCond %{HTTP_HOST} ^top-affiliate.*
RewriteRule ^(.*) http://www.top-affiliate.com/$1 [R,L]
All PR followed just fine.
I guess there is a whole lot more I could do with .htaccess without modifying my httpd.conf files. Looks much simpler.

Brian.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies
Reply With Quote
  #19 (permalink)  
Old 06-30-2005, 11:21 PM
WebProWorld Pro
 
Join Date: Sep 2004
Location: Ewa Beach, Hawaii
Posts: 199
StephenR. RepRank 0
Default

jawn_tech: Heck yeah it's nice, that was driving me nuts :)

brian.mark: Glad I could help.
Reply With Quote
  #20 (permalink)  
Old 06-30-2005, 11:22 PM
WebProWorld MVP
WebProWorld MVP
 
Join Date: Jul 2004
Location: Omaha
Posts: 2,714
brian.mark RepRank 3brian.mark RepRank 3
Default Just tried that...

Just tried that on another site, and it works wonderful. Thanks a ton.

Brian.

[edit]

I had to change to [R=301,L] for a 301, otherwise it was doing a 302 which isn't good.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies
Reply With Quote
Reply

  WebProWorld > Search Engines > Search Engine Optimization Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:46 AM.



Search Engine Optimization by vBSEO 3.3.0