Forum Moderators: phranque

Message Too Old, No Replies

Page Rank and Apache

Can we have global apache rules to help ranking?

         

cocacolafun

1:38 pm on Sep 6, 2007 (gmt 0)

10+ Year Member



It may sound like if I am a newbie, but just recently did I decide to improve my sites for search engines.

Right away, I found out that it is better to do a permanent redirect from http://example.com/ to http://www.example.com/

That I have done.

But now, after checking google page rank, I noticed that my page http://www.example.com/ is ranked higher than http://www.example.com/index.cgi .... but they are the same. In apache, I have root files [index.html, index.php, index.cgi, etc].

Is there a way for apache to permanent redirect my users accessing the root "/" to change the url to "/index.html" if it exist, "/index.php" if it exist, etc?

CCF

[edited by: jdMorgan at 3:07 pm (utc) on Sep. 6, 2007]
[edit reason] example.com. [/edit]

jdMorgan

3:05 pm on Sep 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, there's a way, but it is a bad idea; The 'translation' of a request for example.com/ or example.com/directory/ to example.com/index.xyz or example.com/directory/index.xyz should be transparent to the user; The user does not care what kind of file you use for an index.

Also, there is no reason to reveal what kind of file you use, either to the user or to search engine robots. Consider this: What if you change your main index page from /index.cgi to /index.php? If that page is indexed in search engines as /index.cgi and you change it to /index.php, then that is a new URL; You will lose your search ranking on that page for anywhere from three weeks to a year, depending on your page's ranking and how often it is indexed.

Furthermore, what about type-in traffic? Why require the user to type in the extra URL-path to get your index page?

Therefore, it's best to always link just to "/" and use the DirectoryIndex directive to tell Apache how to map that URL-path to the correct server filepath without revealing that filepath to clients.

Jim

cocacolafun

3:19 pm on Sep 6, 2007 (gmt 0)

10+ Year Member



I kinda agree with you.

How about that if someone access "index.cgi", it redirects them to "/"? I tried to do this, and it almost worked. However when I tried, I was stuck in an infinite loop.

In my htaccess file I had:
RewriteCond %{REQUEST_URI} ^.*index.cgi$
RewriteRule (.*)index.cgi [domainname.com...] [R=301,L]

I think its because I have "index.cgi" in my DirectoryIndex
DirectoryIndex index.html index.wml index.cgi

Why am I bothering? Simply because search engines consider [domainname.com...] and [domainname.com...] two different page.

CCF

g1smd

4:58 pm on Sep 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, redirect to the "/" version.

There is abundant example code, in many prior posts, posted several times per week for redirecting index URLs.

cocacolafun

6:09 pm on Sep 6, 2007 (gmt 0)

10+ Year Member



I found this out there:

RewriteCond %{THE_REQUEST} ^.*\/index\.html?
RewriteRule ^(.*)index\.html?$ [domain.com...] [R=301,L]

OR

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html?\ HTTP/
RewriteRule ^(.*)index\.html?$ [domain.com...] [R=301,L]

Can anyone explain the difference between the two?

CCF

g1smd

6:34 pm on Sep 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I use the second one and it works well.

However I replace html in both lines with html?¦php¦asp¦cfm so that all five (count 'em!) types of index URL are redirected.