Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Possible Duplicate:
Should I use a file extension or not?

My current hosting provider does not let me put PHP code inside of a .html page. So part of my content is in a database and displayed with PHP, but most of it is in pre-rendered .html files. I'd like to put more of it in .php files however I am concerned that search engines will penalize my .php pages because they are PHP. Is there any evidence so that effect? Thanks.

share|improve this question

marked as duplicate by John Conde Jan 15 '13 at 19:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers 3

HTML views are generated by PHP, so you wouldn't be putting PHP code in HTML pages anyway. It's perfectly fine to be using PHP pages, as good SEO practices are server-side language agnostic anyway.

That said, you should be setting up clean URLs that don't have file extensions in the first place, and thus there should be no reason for any search engine (or visitor) to know which scripting language you're using.

share|improve this answer
    
Good point about PHP emitting HTML. –  dadinck Jan 15 '13 at 16:34
    
@Kenzo, my hosting provider is not permitting the no extension option. When I upload a PHP program without an extension, the source code is visible. It appears like a text file. –  Frank E Jan 15 '13 at 22:30
    
@FrankE: I think what Kenzo is saying is, example.com/some-directory/. That would open your default file/filetype. Usually example.com/some-directory/index.html or example.com/some-directory/index.php, etc. Your host should have a way for you to set the default file to execute when none is specified. Then you could set it to be index.php, which outputs the relevant HTML after pre-processing. –  akTed Jan 16 '13 at 5:26
    
In other words, you shouldn't be directing users to example.com/some-directory/whatever.php (or .html, etc.). You should be directing them to example.com/some-directory/whatever/, which actually is executing example.com/some-directory/whatever/index.php. –  akTed Jan 16 '13 at 5:31
    
@AKTed With routing in place, any file could be called to that URL. It doesn't necessarily have to be index.php –  Kenzo Jan 20 '13 at 19:23

There is a trend not to put any extensions on your web pages but have your pages with plain names like ww.co/index or ww.co/main_page. My understanding is that the name of your page does not really mean anything. The title, keywords, and content are more important. Since so many web sites now use web crawler friendly CMS, I don't see how you can be penalized for using intelligent technology for organizing your web site.

share|improve this answer
    
Hyphens in URLs, not underscores. And, keywords in the URL are a top 10 SEO ranking factor. –  Kenzo Jan 15 '13 at 16:33
    
And, a CMS is not visible to search engines. –  Kenzo Jan 15 '13 at 16:37
1  
@kenzo, underscores don't make enough of a difference to downvote. See updated advice: youtube.com/watch?v=AQcSFsQyct8 –  dadinck Jan 15 '13 at 16:44
    
@kenzo: The way CMS brings content up in the URL makes a difference. Using POST to bring up content is not crawler friendly. Using GET with anchors and consistent URL content is crawler friendly. –  dadinck Jan 15 '13 at 16:46
    
That's not the CMS. That's the business logic of the site. Two totally different things. –  Kenzo Jan 15 '13 at 16:48

First of all don't be concerned about search engines punishing your PHP pages. It should be perfectly fine. The only reason I could think of would be slow loading speed. But for that you would really need to have slow code (loop in a loop etc) and then I would rather be concerned about that slow code in general.

About 'the other' HTML/PHP question: The HT in HTML means Hyper Text and the HP in PHP means Hypertext Preprocessor…:)

And about the 'trend' of not having extensions at all: you can of course leave the actual file name out if you're using "index.php" or "index.php" So instead of "contact.php" you use "contact/index.php" and that becomes "contact/".

Hope this reply is of any use? -cheers- till...

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.