Forum Moderators: phranque

Message Too Old, No Replies

301 redirect problem

Can anyone explain why this doesn't work?

         

trillianjedi

9:16 am on Jun 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You may remember I posted last week asking how to redirect:-

www.mydomain.com/index.php

to

www.mydomain.com/

(or the other way around).

The purpose of this is we have high quality inbound links going to a mixture of both, and we want to concentrate the PR onto one link, rather than have it spread over two.

As I understand it google allocates PR on a link basis, so even though these two URL's both resolve exactly the same page, they will be calculated individually.

So we put this into .htaccess:-

redirect 301 /index.php h*tp://www.mydomain.co.uk/

And it doesn't work - won't resolve the index page at all (looks rather like it's getting stuck in a loop).

Any ideas?

Many thanks,

TJ

Nick_W

9:25 am on Jun 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this:

Redirect 301 /index.php http://www.mydomain.co.uk/

Captital 'R' ;)

I had awful trouble with this when I had to do it but this page [httpd.apache.org] has a capital R but is otherwise the same as you have.

You could also try:

Redirect permanent /index.php http://www.mydomain.co.uk/

Nick

Birdman

11:53 am on Jun 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

You may want to try mod_dir [httpd.apache.org]:

DirectoryIndex index.php

That line would go in your .htaccess file and then you won't need the redirect. Now any request for a dir(eg. site.com/foo/ or site.com/) will automatically serve index.php.

trillianjedi

12:25 pm on Jun 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Birdman, but I don't think that would do what I need, which is to get google to recognise that "/" has been permanently redirected to "/index.php" or vice-versa.

That way the PR from our inbound links gets transferred.

I'll try Nick's suggestion as soon as my webhost gets back!

TJ

jdMorgan

6:23 am on Jun 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



TJ,

If none of the above work, the following method may break the "loop":

1) Rename your index.php file to main.php.

2) In .htaccess, place:


Options -Indexes
DirectoryIndex main.php
RedirectMatch ^/index\.php$ http://www.yourdomain.com/

Never refer to your index file as anything other than "/" in any link, internal or external. Leave the redirect in place and stick with the "main.php" name for at least 6 months - make sure the search engines all update their listings to show your home page as "yourdomain.com/" (Ink's Slurp is usually very slow). After that time, you can take out the .htaccess code, rename the page back to index.php, and change DirectoryIndex back to point to index.php if you want to.

See Apache [httpd.apache.org] core, mod_dir, and mod_alias.

HTH,
Jim