Forum Moderators: phranque

Message Too Old, No Replies

Root domain returns 301

...after changing to index.php

         

Birdman

12:50 pm on May 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

I changed one of my sites to PHP months ago and have just realized that I get a 301 redirect when using www.mysite.com because the home page now has a .php extension.

How should I deal with this issue and what are the negatives that I have caused by not dealing with it right away?

Thanx!

grahamstewart

1:38 pm on May 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think you should get a 301 if its properly set up.

On Apache you specify which files can be index files in httpd.conf..


<IfModule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>

That way the index.php file should get server when no index.html file is present - no redirection required.

Birdman

1:44 pm on May 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can I do this in .htaccess? I don't thinkI have access to httpd.conf.

Also, after doing this, is there anything else I need to do to get my home page listed as www.site.com in the engines, rather than the www.mysite.com/index.php?

Thanks for the help!

grahamstewart

11:15 pm on May 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yup should be fine in .htaccess (sorry I should have said that).
See [httpd.apache.org...] for more info.

Not sure about the search engines tho. I would hope they would have the sense to just list you as www.mysite.com but who knows?

Another little thing I do is I don't actually specify the file (index.html or index.php or whatever) in any of my links, just the directory.

e.g.
<a href="/">Home</a>
<a href="/products/">Our Products</a>

That way I can use html or php, and its less hassle to switch to a different language in the future if required.

DrDoc

11:16 pm on May 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



just put

DirectoryIndex index.php

in your .htaccess :)

Birdman

11:27 am on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the replies!

>>Another little thing I do is I don't actually specify the file (index.html or index.php or whatever) in any of my links, just the directory.

Yes, I use "/" for all home page links. It's just that, since I changed to PHP, Google started listing the home page with the index.php at the end of the url. I guess because it gets redirected there.

I'm tempted to just go back to index.html since the only PHP on the home page pulls my main nave menu, which I could just make static. The rest of the site is completely dynamic.

I'm just wondering if this has affected me adversely. I dropped bigtime in the update, but so did many others.

What I'll do is use your suggestion to make index.php the default home page and then do the header check again. If I get 200, I should be okay and Google should list me normally again, right?

I'm a bit confused on this but I surely don't want my home page to be a 301. I'll let you know how it goes. Thanks Graham and Doc!

Birdman

11:33 am on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Okay, I got a 200 response so I guess all is well. I'll just have to wait and see if they change my listing back to www.site.com/.

Thanks again!

Birdman

2:42 pm on May 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just for an update, the root domain is now showing with a fresh date, right under the /index.php listing. Didn't take long! I just wonder if they will leave the /index.php listing or remove it.