I see that some sites change their pages e.g from .php to .html, why? and how they do that? like: http://www.huffingtonpost.com/2009/11/30/why-newspapers-wont-get-r%5Fn%5F373588.html

do they make first dynamic pages and then making .html and put in a folder?

thanks

link|improve this question
feedback

6 Answers

up vote 4 down vote accepted

Are you sure it's not actually a .html file?

Jeff Atwood's site, Coding Horror, pre-generates every page, staticly, to keep server load down. It's a good strategy, and certainly a lot cheaper than buying stronger servers. The page needs to be entirely recreated for each new comment, but that's most likely going to happen a lot less than creating it once per visitor, grabbing comments from the database, so on and so forth.

link|improve this answer
Thanks for all answers,but let me explain more,until now i thought and think that .html file make with hand in an editor and it doesn't need database (i don't know that am i right?) ,so if these pages are .html as i think ,it is very difficult to make it and what happen if you want that users make search on your site? i must have database to manage data,i have a magazine online with database ,but when i see these sites that i put its link i tell myself that i'm in wrong way,specially that for a magazine there are some daily news that after sometimes are not usefull so if i put all in a db ok? – Kaveh Dec 10 '09 at 7:36
My magazine is not online just "have design with php+mysql . – Kaveh Dec 10 '09 at 7:38
I'm not sure it is a html file,i have confused ,another link that i have really confused is : rollingstone.com/rockdaily/index.php/2009/12/07/… i have learned that e.g /index.php?articleid=56 – Kaveh Dec 10 '09 at 7:46
A .html file is very difficult to make for a LOT of things. For small sites that don't need to change, HTML is perfect. For, say, here, PHP (or ASP.net, as the case may be), is pretty much required. Searching is certainly easier using a database, but google and others provide a great method to search static HTML. For a magazing anywhere from small to really big, PHP (or any other dynamic language) is the way to go. It's only when you get to supermassive can't-handle-it's-own-traffic sizes that you need to start thinking about generating static pages. – Phoshi Dec 10 '09 at 8:37
feedback

(Aside from mod_rewrite) It's actually trivial to set your server config so that it parses practically any file extension as a PHP script. Using the .HTML extension makes the most sense.

link|improve this answer
Thanks ,i read an article on issue of "mod_rewrite" that you mentioned, on sitepoint.com ,it was very good ,but there is a question for me ,when we configure our server for "mod_rewrite" the .html pages that generate is real?my mean is that if we have 100,1000 recordes then 100.1000 html files generate and we must put in folders on server ?or each time that user request a record like book.php?id=45 then an html file creat and then dead? – Kaveh Dec 10 '09 at 16:05
Sorry, it is 100,000 – Kaveh Dec 10 '09 at 16:06
@Kaveh: The answer is no. – davr Jan 22 '10 at 17:22
feedback

First of all, it could really be a static HTML page, you don't know that they are using PHP, do you?

Secondly, you can change your URLs to whatever you want using mod_rewrite in Apache.

link|improve this answer
feedback

Links as you describe (especially PHP) are generally written to the generic html form using an ".htaccess" file. This is where the mod_rewrite is used (the one Davr described in his answer). The benefit of rewriting URLs is that they can be transformed to something that is more useable.

Different examples have different purposes. A few examples of why someone would rewrite a URL are:

  • To change a short URL to a longer more descriptive one that has more meaning (as in your examples, the title is in the URL itself)
  • Shortening an unnecessarily long URL
  • Or, if the PHP URL is a broken link (an old link that no longer exists), mod_rerite and .htaccess can be used to redirect the old URL location to a new one so the user sees the moved content they were looking for.
link|improve this answer
feedback

To throw something else out on the "it really is html" heap. It could be that the basic structure of the page is static html and all the content is loaded via ajax calls.

link|improve this answer
I have design my magazine with php+mysql ,so do i need use ajax also? can you guide me? please read my comments on Phoshi. – Kaveh Dec 10 '09 at 7:49
Sounds like what you need to look into is RSS feeds. Most news sites provide them so you should be able to use that in cases where the static html pages are not returning the correct data. – ongle Dec 10 '09 at 15:07
But for the magazine i must provide my "articles" and "news" manually so in these cases ajax can help? – Kaveh Dec 10 '09 at 15:51
1  
No, ajax isn't going to help you in these cases. – ongle Dec 11 '09 at 2:59
feedback

To answer the "why" part of your question. In SEO circles it's thought that .html files gain more weight with search engines than dynamically generated pages. The validity of this is doubtful given how easy it is to fake (as shown in other responses).

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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