Forum Moderators: phranque

Message Too Old, No Replies

Different PR will this help me to club them

pr

         

benevolent001

11:34 am on Dec 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have website that has diff Pr for
www and without
so shd i add redirect in htacces file to direct non www traffic to www
will this help me to club Pr

and would appreciate if you can give me code to write in my htaccess file for permanent redirect

With Regards

benevolent001

12:52 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi i have got following codes can some one of you please tell me which i is needed to the required

redirect 301 [my.com...] [my.com...]

Code 2

if($_SERVER['HTTP_HOST']=='example.com') {
header("HTTP/1.1 301 Moved Permanently");
header("Location: [example.com...]
header("Connection: close");
}

larryhatch

1:38 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A very good question, and I don't have the answer.
Instead, another question:

www.mysite.net/ rates a PR of 6/10 on one online checker.
mysite.net/ only rates 2/10. ( i.e. no www. )

Will a redirect indeed improve the PR for the real url with the www in it?
Could this help with my positioning in the SERPs?

- Larry

Span

1:56 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From what I know, yes. Domain.tld and www.domain.tld are two different things and therefore have their own pagerank.

This is code for in an .htaccess, redirects requests without the www to www.


RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.tld [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [R=301,L]

benevolent001

2:15 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi thanks fir this code it worked like cake walk

can i add this code for all my pages having same problem instead of main website url.will this help me more?
as i have seen that i have urls of different pages listed in engines without and with www both so will this help me with added advantage?

Once again thanks for your code

With Regards and Best wishes

benevolent001

2:17 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oh great i have found it works for individual pages too
I hope this will club by PR of 3 and 4 and give me atleast 5 in next update
Thanks a lot for great code

larryhatch

2:23 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Span: More questions:

1) Do I need a statment 'RewriteEngine Off' at the end?
My first experiment with .htaccess shut down my entire site, so I'm really leery ..

2) Do I save .htaccess to the root directory on my host ISP,
i.e. right alongside index.html, or someplace else?

3) Does this count as a classical '301 redirect' so often mentioned in these discussions?

4) IF SO, do any ratings or rankings benefits accrue to my main www.mysite.net pages?

5) I have no .htaccess file in use now. If I put one up with the 301 redirect as given,
can I ADD exclusions to the very same file later?
(That would be to exclude obnoxious robots.)

- Larry

benevolent001

2:36 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Larry
I hop i can answer some of these not all

1) Do I need a statment 'RewriteEngine Off' at the end?
My first experiment with .htaccess shut down my entire site, so I'm really leery ..

You just write your domain name and .com .org etc. i place of tld

2) Do I save .htaccess to the root directory on my host ISP,
i.e. right alongside index.html, or someplace else?

You have .htaccess file in www or public_html directory its same where other pages are

3) Does this count as a classical '301 redirect' so often mentioned in these discussions?

Dont know about this wd like to know more


4) IF SO, do any ratings or rankings benefits accrue to my main www.mysite.net pages?

As far as i know our rating should go up faster then otherwise as this wd help google to club pages faster otherwise it wd have taken atleast 6 months


5) I have no .htaccess file in use now. If I put one up with the 301 redirect as given,
can I ADD exclusions to the very same file later?
(That would be to exclude obnoxious robots

You can just make a .htaccess file with notepad and add the code as written above ,place it in ur root

Span

2:46 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1) No 'RewriteEngine Off' needed. You only need that for directories in which you don't want rewrites to happen if you can't exclude those directories in your root .htaccess.

2) Yes, save it to the root. Where your index.html lives.

3) Yes, this is classical 301.

4) From what I've seen in Google and read in these forums Pagerank is not related to ranking in the SERPS. But you should benefit from this. In the Google forum are stories about sites that disappeared from the SERPS because of duplicate content, caused by this. Actually, www is a subdomain from domain.tld. So it's important to redirect one to the other.

5) Once you have an .htaccess on your domain you can add all kinds of rewrites, redirects, etc to the same file.

larryhatch

3:33 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks again Span!

You have answered all my questions clearly, simply and directly.

I presume I can create an .htaccess file as htaccess.txt, then upload it as such,
and finally rename it to .htaccess once up at the host directory.

If the world comes to an end, I can just erase it.

If not, this may make an interesting test.
Right now, my index.html page comes up #25-30 (3rd page) on Google for my main short keyword.
If this changes much, I will have learned something.

Best

- Larry

larryhatch

3:50 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK! Worked like a charm.

As a test, I called up [mydomain.net....]
Up popped [mydomain.net....]
Same thing worked with other file names, no-www ==> www on 3rd level pages.

Wow! My very first real 301 redirect. Maybe I should bake a cake.

One strange thing! When I sent up htaccess.txt, it showed in my host's directory as expected.
Once I RENAMED it to .htaccess, it vanished from the visible directory!

Is this normal?

Thanks again - Larry

kevinpate

3:51 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> rename it to .htaccess once up at the host
> directory

or, save it locally using quotes, i.e.,
".htaccess" and then upload it.

Span

6:43 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>> Once I RENAMED it to .htaccess, it vanished from the visible directory!

Files starting with a dot are meant to be invisible. But somewhere in your FTP program should be a little "Show Invisible Files" button, I hope..

jdMorgan

10:32 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Alternatively, your FTP client may have a "LIST command" option, where you can type in "list -a" to see *all" files.

> Do I need a "RewriteEngine off" directive?

No, not unless you have RewriteRules that you want to disable temporarily. In that case, you can use RewriteEngine off ahead of the rules you want to disable.

Jim

larryhatch

12:12 am on Dec 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks guys! That's another load off my mind ..

"Files starting with a dot are meant to be invisible.
But somewhere in your FTP program should be a little "Show Invisible Files" button, I hope.. :

I'm using WS_FTPle so FTP files up and down to host.

If somebody knows how to make that display invisible files, I'm all ears.
I don't see any special button or command line to force showing invisible files.

It would be reassuring to see it, but I'd rather not have it publicly available.

I will now experiment to see if I can download .htaccess publicly,
i.e. as another document/page instead of FTPing it.

- Larry

larryhatch

4:57 am on Dec 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One small update regarding .htaccess.

I never found a way to display it in my root directory files list, BUT, I know its there.

Two 'visitors', one in Pakistan, the other in Holland, tried to download it.
This didn't show in access_log, but rather the error.log files.
They got an access denied message of some sort, not a 404-error.

Now I'm wondering why somebody halfway around the world wants my .htaccess information.

Spammers maybe? - Larry