Search Engine Questions

I have the following code in my .htaccess file, to omit the file extension .php in the url for each file:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

Right now, I have pages in the search engine show up with both the .php and without. How can I make sure it will show up without?
Also, I have two more problems.
How can I make sure the search engines only display my site without the www?
How can I make sure the search engines display http://mysite.com instead of http://mysite.com/index or http://mysite.com/index.php

Thanks!

Try this:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^mysite\\.com$ [NC]
RewriteRule .? http://mysite.com%{REQUEST_URI} [R=301,L] 

(Obvioulsy you don’t need to repeat the first line if you have it already.)

andy,

Ralph got the second part correct, just use the same flags on the first part which looks fine at your end. The 301 redirection will tell the SE’s to make that a permanent redirection and update their records.

Thanks, Ralph!

Regards,

DK

Okay- I’ve got the www part.
How do I make sure that the search engines only display mysite.com instead of mysite.com/index.php.
Also, how do I make sure that the search engines display mysite.com/page_name instead of mysite.com/page_name.php?
Thanks!

aww,

www is easy, I’d not worry about the index.php (except to remove the extension) and removing the extensions will be picked-up by SE’s with 301’s on their link redirections.

Regards,

DK