.html to .php

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

.html to .php

Post by Luke »

Does changing the extension of php files to html (with a .htaccess file) make the pages more search engine friendly? If so, how?
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

No.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I can't imagine it would. A php file just dumps HTML anyway so the *content* of the file would be the same. As for the file extension, I'm not sure search engines care. That said, I believe I've heard that *.shtml files are not indexed by all bots.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I could have sworn I heard that html extensions are more engine-safe than php files. Are you guys CERTAIN?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

search engines don't care about the file extension.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

You might have heard it's better to have say:

site/user/1062/

...than it is to have:

site.php?user=1062

If you're wondering about getting something like that done, research mod_rewrite for Apache
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

thank you
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Doesn't Google now allow query strings? In which case the url format probably doesn't matter to a search engine. Of course search engines may differ - I rarely use anything except Google so I should keep that in mind.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Google has for quite a while traversed urls with query strings.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

What if you had php code in a html page, would it work because I have gotten problems trying it?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: .html to .php

Post by Roja »

The Ninja Space Goat wrote:Does changing the extension of php files to html (with a .htaccess file) make the pages more search engine friendly? If so, how?
It depends on which search engine, however, lets focus on the big three, if we want to be reasonable. (Google, MSN, Yahoo).

In that case, no. It doesn't. All three treat both equally. Of course, unrelated is that if a php file can't handle the load (infinite loop much!?), then the search engine won't see it as often. But thats not the file extension, thats the programming/availability of the page.
Pickle wrote:That said, I believe I've heard that *.shtml files are not indexed by all bots.
All three of the majors do.
The Ninja Space Goat wrote:Are you guys CERTAIN?
No, Roja. Thats the nick, its easy to remember. Am I sure? Roja.
Sami wrote:You might have heard it's better to have say: site/user/1062/
Misleading. For the major search engines, that used to be true, but isn't any longer.

As a best practice, its still "better", because you can change content type (Moving from perl to php?) and won't have to update the url. That has nothing to do with the search engine. Search engines love query urls equally now.
nickman013 wrote:What if you had php code in a html page, would it work because I have gotten problems trying it?
Not sure what you mean by php code IN an html page. That doesn't quite make sense.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

For example

home.html

Code: Select all

<html>
<?php
php code 
php code
?>
<font color=red>Whats up!</font>
</html>
Would the php work?

Ive tried to do this before some times it worked, sometimes it didnt.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

nickman013 wrote:Would the php work?
Only if the server is configured to parse html as php.

But doing so means it is a php file, despite the .html extension.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Re: .html to .php

Post by m3mn0n »

Roja wrote:
Sami wrote:You might have heard it's better to have say: site/user/1062/
Misleading. For the major search engines, that used to be true, but isn't any longer.
Of course, that's why I didn't imply otherwise. :wink:

I was just trying to point him in the right direction since it was obvious that's the sort of thing he was talking about.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: .html to .php

Post by Roja »

Sami wrote: I was just trying to point him in the right direction since it was obvious that's the sort of thing he was talking about.
It definitely wasn't obvious to me. The original question was specifically about making pages more search engine friendly. Those urls no longer have any impact on search engine friendliness.
Post Reply