NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Webmaster Tutorials
Reload this Page Redirecting sitename to www.sitename

Webmaster Tutorials Instructional webmaster-related how-to's and tutorials.

Advanced Search
2 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 09-10-2007, 11:46 PM THREAD STARTER               #1 (permalink)
I'll do it
 
-Nick-'s Avatar
Join Date: Dec 2005
Location: India
Posts: 6,939
-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness
 


Member of the Month
September 2007
Adoption

Redirecting sitename to www.sitename


Redirecting your sitename.com to www.sitename.com with help of .htaccess

Create a .htaccess file or add the code to an existing one on your server.

If you are creating a new .htaccess file make sure it is in the root folder of the site.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^sitename.com [nc]
rewriterule ^(.*)$ http://www.sitename.com/$1 [r=301,nc]

Where sitename.com and www.sitename.com will be replaced by your original details of the site itself.
????: NamePros.com http://www.namepros.com/webmaster-tutorials/372675-redirecting-sitename-to-www-sitename.html

This will only work on apache servers with mod_rewrite enabled.
Last edited by -Nick-; 10-06-2007 at 01:41 AM.
-Nick- is offline  
Old 09-11-2007, 02:05 AM   #2 (permalink)
NamePros Member
 
Tobiasz's Avatar
Join Date: Aug 2007
Location: Poland
Posts: 80
Tobiasz is an unknown quantity at this point
 



And last but not least - do not forget about last empty line (just hit Enter after last line of code twice)
__________________
I'm buying Polish domains (Polish words + any TLD and all names + .pl).
Tobiasz is offline  
Old 09-11-2007, 04:38 AM   #3 (permalink)
Danltn.com
 
Daniel's Avatar
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
 


Ethan Allen Fund Ethan Allen Fund
The alternative rule:

Code:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.site\.us$ [NC]
RewriteRule ^(.*)$ http://site.us/$1 [R=301,L]
Last edited by Danltn; 10-08-2007 at 08:56 AM.
Daniel is offline  
Old 09-23-2007, 06:51 AM   #4 (permalink)
NamePros Regular
 
blatant's Avatar
Join Date: Aug 2006
Location: NE
Posts: 455
blatant is a glorious beacon of lightblatant is a glorious beacon of lightblatant is a glorious beacon of lightblatant is a glorious beacon of lightblatant is a glorious beacon of lightblatant is a glorious beacon of light
 



Thanks worked like a charm!
__________________
:camera: Talk Stangs.com-Lets Talk about Stangs! :o
225 and LPX .US bzet .com oqpj .com
-Offer through PM-
blatant is offline  
Old 10-05-2007, 06:44 AM   #5 (permalink)
Senior Member
Join Date: Jan 2006
Posts: 4,187
Steve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond repute
 



Thanks, Nick. I've been too lazy to dig up this code.
__________________
Steve
NamePros Staff Emeritus
Steve is offline  
Old 10-12-2007, 01:51 AM   #6 (permalink)
Account Suspended
 
Waiter's Avatar
Join Date: Jan 2007
Posts: 258
Waiter is an unknown quantity at this point
 



So does it mean if I type sitename in brouther it redirects you to sitemname.com? I have seen such situations, but I thought it is google.
Waiter is offline  
Old 10-12-2007, 01:53 AM   #7 (permalink)
goof free!
Join Date: Mar 2006
Location: Canada
Posts: 9,359
mis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatness
 


Member of the Month
November 2007
Save a Life VA Tech Memorial Breast Cancer Protect Our Planet Protect Our Planet
Originally Posted by Waiter
So does it mean if I type sitename in brouther it redirects you to sitemname.com? I have seen such situations, but I thought it is google.

????: NamePros.com http://www.namepros.com/showthread.php?t=372675
It means if you type in sitename.com it
takes you to www.sitename.com

mis_chiff is offline  
Old 10-20-2007, 12:11 PM   #8 (permalink)
NamePros Member
Join Date: Oct 2007
Posts: 51
Pointer is an unknown quantity at this point
 



By the way,
I heard, that Google like website which are redicting from http:// to http://www.
I mean, it help with PageRank.
Pointer is offline  
Old 10-20-2007, 01:13 PM   #9 (permalink)
Danltn.com
 
Daniel's Avatar
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
 


Ethan Allen Fund Ethan Allen Fund
Originally Posted by Pointer
By the way,
I heard, that Google like website which are redicting from http:// to http://www.
????: NamePros.com http://www.namepros.com/showthread.php?t=372675
I mean, it help with PageRank.
Never heard of that.
Never had proof of that.

Could you tell me where you found this information?
Daniel is offline  
Old 10-20-2007, 04:35 PM   #10 (permalink)
Traveller
 
-NC-'s Avatar
Join Date: Mar 2007
Location: Yet another city
Posts: 1,419
-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future
 


Animal Cruelty Animal Rescue Ethan Allen Fund Protect Our Planet
Matt Cutts suggests it's a good idea:

Quote:
You can make your webserver so that if someone requests http://example.com/, it does a 301 (permanent) redirect to http://www.example.com/. That helps Google know which url you prefer
http://www.mattcutts.com/blog/seo-ad...onicalization/
__________________
NameCooler.com
-NC- is offline  
Old 10-27-2007, 01:27 AM   #11 (permalink)
Danltn.com
 
Daniel's Avatar
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
 


Ethan Allen Fund Ethan Allen Fund
Originally Posted by -NC-
Matt Cutts suggests it's a good idea:

Quote:
You can make your webserver so that if someone requests http://example.com/, it does a 301 (permanent) redirect to http://www.example.com/. That helps Google know which url you prefer
http://www.mattcutts.com/blog/seo-ad...onicalization/
He doesnt' say either is better, he says Google learns your preference.
Daniel is offline  
Old 10-27-2007, 04:43 PM   #12 (permalink)
Senior Member
Join Date: Jan 2006
Posts: 2,356
irishmat has much to be proud ofirishmat has much to be proud ofirishmat has much to be proud ofirishmat has much to be proud ofirishmat has much to be proud ofirishmat has much to be proud ofirishmat has much to be proud ofirishmat has much to be proud ofirishmat has much to be proud ofirishmat has much to be proud of
 



are there any other ways of doing this as its not working for my site

www.7dl.com resolves, 7dl.com doesnt
__________________
Y5S.com for sale - PM mepoker blog
irishmat is offline  
Old 12-05-2007, 05:40 AM   #13 (permalink)
i love automation
 
xrvel's Avatar
Join Date: Nov 2007
Location: xrvel.com
Posts: 1,615
xrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant future
 




I have default .htaccess :
Code:
# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.{mydomain}.com
AuthUserFile /home/iwantw/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/iwantw/public_html/_vti_pvt/service.grp
Where should i add the add-on htaccess code?
__________________
xrvel is offline  
Old 12-09-2007, 11:27 PM   #14 (permalink)
NamePros Regular
 
indowebber's Avatar
Join Date: Nov 2006
Location: Fishin Screen!
Posts: 958
indowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud of
 




am i know why i must directing ?
and because as i can see there some people just prefer to http://domain and some people have choose http://www.domain so, which one the best ?
and if i want to use http://domain is it right the code off httacsess
Code:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^\.site\.us$ [NC]
RewriteRule ^(.*)$ http://site.us/$1 [R=301,L]
regards
indowebber is offline  
Old 12-09-2007, 11:35 PM   #15 (permalink)
goof free!
Join Date: Mar 2006
Location: Canada
Posts: 9,359
mis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatnessmis_chiff Has achieved greatness
 


Member of the Month
November 2007
Save a Life VA Tech Memorial Breast Cancer Protect Our Planet Protect Our Planet
Originally Posted by xrvel
I have default .htaccess :
Code:
# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.{mydomain}.com
AuthUserFile /home/iwantw/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/iwantw/public_html/_vti_pvt/service.grp
Where should i add the add-on htaccess code?
Add the code umat_gila pasted above,
????: NamePros.com http://www.namepros.com/showthread.php?t=372675
on a new line in your .htaccess right after what you posted above.
mis_chiff is offline  
Old 12-10-2007, 01:20 AM   #16 (permalink)
i love automation
 
xrvel's Avatar
Join Date: Nov 2007
Location: xrvel.com
Posts: 1,615
xrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant future
 




Originally Posted by mis_chiff
Add the code umat_gila pasted above,
on a new line in your .htaccess right after what you posted above.
Thanks. it works
__________________
xrvel is offline  
Old 12-12-2007, 01:43 PM   #17 (permalink)
NamePros Regular
 
indowebber's Avatar
Join Date: Nov 2006
Location: Fishin Screen!
Posts: 958
indowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud ofindowebber has much to be proud of
 




[QUOTE=xrvel]I have default .htaccess :
Code:
# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.{mydomain}.com
AuthUserFile /home/iwantw/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/iwantw/public_html/_vti_pvt/service.grp

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^\.site\.us$ [NC]
RewriteRule ^(.*)$ http://site.us/$1 [R=301,L]
thats the conclusion right ?
????: NamePros.com http://www.namepros.com/showthread.php?t=372675
ill try
__________________
Cheap SEO Article Services <-- Great Deals on Opening, try it now!
indowebber is offline  
Old 04-22-2008, 01:35 AM   #18 (permalink)
Senior Member
 
trsaso's Avatar
Join Date: Aug 2006
Location: Little place around the World
Posts: 1,711
trsaso has much to be proud oftrsaso has much to be proud oftrsaso has much to be proud oftrsaso has much to be proud oftrsaso has much to be proud oftrsaso has much to be proud oftrsaso has much to be proud oftrsaso has much to be proud of
 




Originally Posted by -Nick-
Redirecting your sitename.com to www.sitename.com with help of .htaccess
????: NamePros.com http://www.namepros.com/showthread.php?t=372675

Create a .htaccess file or add the code to an existing one on your server.

If you are creating a new .htaccess file make sure it is in the root folder of the site.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^sitename.com [nc]
rewriterule ^(.*)$ http://www.sitename.com/$1 [r=301,nc]

Where sitename.com and www.sitename.com will be replaced by your original details of the site itself.

This will only work on apache servers with mod_rewrite enabled.
Tested on my site and working wery well , rep+
Thanks
__________________
When Its a BREAND dont need others. Value Technologies
CouponFor.Me - Best and fresh Coupons
Strong Directory - Free Play
trsaso is offline  
Old 04-22-2008, 03:26 AM THREAD STARTER               #19 (permalink)
I'll do it
 
-Nick-'s Avatar
Join Date: Dec 2005
Location: India
Posts: 6,939
-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness
 


Member of the Month
September 2007
Adoption
Thanks I am much happy that it helped you all. It is this that always inspires me to write stuff
-Nick- is offline  
Old 04-28-2008, 10:19 AM   #20 (permalink)
New Member
Join Date: Apr 2008
Posts: 13
trampy is an unknown quantity at this point
 



The reason why you might do this for google or any other search engine is that there is a limit as to how many characters the crawler recognizes in the url. So if you have a long url with a lot of keywords in it the loss of the www gives you three extra characters.

I think limit is like 255 characters typically which is a lot, but if you have some script generating your page names it could happen.
__________________
webkinz recipes
recipe for cake recipes, chicken recipes, cookie recipes, bread recipes, kids recipes, food
free guitar tabs, lessons
wii-bundle
trampy is offline  
Old 04-28-2008, 02:26 PM THREAD STARTER               #21 (permalink)
I'll do it
 
-Nick-'s Avatar
Join Date: Dec 2005
Location: India
Posts: 6,939
-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness
 


Member of the Month
September 2007
Adoption
That's a good suggestion trampy

Will keep it in mind whenever there is a situation like this. But it rarely comes. Yet it might be beneficial for someone

Thanks for posting it
-Nick- is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 11:00 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger