09-10-2007, 11:46 PM
· #1 I'll do it
Name: Keral. Patel.
Location: India
Join Date: Dec 2005
Posts: 4,642
NP$: 14180.40 (
Donate )
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.
This will only work on apache servers with mod_rewrite enabled.
Last edited by -Nick- : 10-06-2007 at 01:41 AM .
09-11-2007, 02:05 AM
· #2 NamePros Member
Join Date: Aug 2007
Posts: 74
NP$: 100.00 (
Donate )
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).
Got domains? Make a
PROFIT !
Register
ALL TLDs in one place.
09-11-2007, 04:38 AM
· #3 Danltn.com
Name: Daniel Neville
Location: Danltn.com / Nottingham, UK
Join Date: May 2007
Posts: 1,164
NP$: 642.56 (
Donate )
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 .
09-23-2007, 06:51 AM
· #4 DNOA Member
Location: NE
Join Date: Aug 2006
Posts: 416
NP$: 37.70 (
Donate )
Thanks worked like a charm!
__________________
Talk Stangs.com -
Lets Talk about Stangs!
225 and LPX .US bzet .com oqpj .com
-Offer through
PM -
10-05-2007, 06:44 AM
· #5 Resident Naysayer
Name: Steve
Location: Lehigh Valley, PA
Join Date: Jan 2006
Posts: 3,082
NP$: 620.76 (
Donate )
Thanks, Nick. I've been too lazy to dig up this code.
10-12-2007, 01:51 AM
· #6 NamePros Member
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.
10-12-2007, 01:53 AM
· #7 Senior Member
Join Date: Mar 2006
Posts: 3,976
NP$: 3208.55 (
Donate )
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.
It means if you type in sitename.com it
takes you to
www. sitename.com
__________________
Signatures should be no more than FOUR lines in length and may not contain
images or fonts larger than Size 2 .
10-20-2007, 12:11 PM
· #8 NamePros Member
Join Date: Oct 2007
Posts: 51
NP$: 119.00 (
Donate )
By the way,
I heard, that Google like website which are redicting from http:// to
http://www .
I mean, it help with PageRank.
10-20-2007, 01:13 PM
· #9 Danltn.com
Name: Daniel Neville
Location: Danltn.com / Nottingham, UK
Join Date: May 2007
Posts: 1,164
NP$: 642.56 (
Donate )
Originally Posted by Pointer By the way,
I heard, that Google like website which are redicting from http:// to
http://www .
I mean, it help with PageRank.
Never heard of that.
Never had proof of that.
Could you tell me where you found this information?
10-20-2007, 04:35 PM
· #10 Stranger
Location: in a strange land
Join Date: Mar 2007
Posts: 1,238
NP$: 779.28 (
Donate )
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-a...nonicalization/
10-27-2007, 01:27 AM
· #11 Danltn.com
Name: Daniel Neville
Location: Danltn.com / Nottingham, UK
Join Date: May 2007
Posts: 1,164
NP$: 642.56 (
Donate )
Originally Posted by -NC-
He doesnt' say either is better, he says Google learns your preference.
10-27-2007, 04:43 PM
· #12 Senior Member
Join Date: Jan 2006
Posts: 2,171
NP$: 116.00 (
Donate )
are there any other ways of doing this as its not working for my site
www.7dl.com resolves, 7dl.com doesnt
12-05-2007, 05:40 AM
· #13 xrvel is cruel :-)
Name: Kurniawan
Location: Indonesia
Join Date: Nov 2007
Posts: 781
NP$: 3222.31 (
Donate )
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?
12-09-2007, 11:27 PM
· #14 NamePros Regular
Join Date: Nov 2006
Posts: 284
NP$: 35.00 (
Donate )
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
12-09-2007, 11:35 PM
· #15 Senior Member
Join Date: Mar 2006
Posts: 3,976
NP$: 3208.55 (
Donate )
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,
on a new line in your .htaccess right after what you posted above.
__________________
Signatures should be no more than FOUR lines in length and may not contain
images or fonts larger than Size 2 .
12-10-2007, 01:20 AM
· #16 xrvel is cruel :-)
Name: Kurniawan
Location: Indonesia
Join Date: Nov 2007
Posts: 781
NP$: 3222.31 (
Donate )
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
12-12-2007, 01:43 PM
· #17 NamePros Regular
Join Date: Nov 2006
Posts: 284
NP$: 35.00 (
Donate )
[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 ?
ill try
04-22-2008, 01:35 AM
· #18 Senior Member
Name: Saso
Location: Little place around the World
Join Date: Aug 2006
Posts: 1,137
NP$: 371.75 (
Donate )
Originally Posted by -Nick- 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.
This will only work on apache servers with mod_rewrite enabled.
Tested on my site and working wery well , rep+
Thanks
04-22-2008, 03:26 AM
· #19 I'll do it
Name: Keral. Patel.
Location: India
Join Date: Dec 2005
Posts: 4,642
NP$: 14180.40 (
Donate )
Thanks
I am much happy that it helped you all. It is this that always inspires me to write stuff
04-28-2008, 10:19 AM
· #20 New Member
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.
04-28-2008, 02:26 PM
· #21 I'll do it
Name: Keral. Patel.
Location: India
Join Date: Dec 2005
Posts: 4,642
NP$: 14180.40 (
Donate )
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
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off