开发者

Does anyone use index.html?

As a matter of precaution i开发者_JAVA技巧 always, now, name my index page: index.php, I do this whatever the project. Does anyone use index.html regularly? Can you be concretely sure you'll never need PHP for the page? Are there any performance issues encountered by always using index.php over index.html?


For servers that don't support PHP, avoid the .php extension unless you are trying to mask the server technology by faking a .php extension.

For static sites it doesn't really matter which extension you use as long as you know your server is configured correctly (see Dominic Rodger's answer). For that matter, not many of your visitors will care whether it's a static or dynamic site. Also, some dynamic sites accept URLs that end in .html as opposed to .php.

Are there any performance issues encountered by always using index.php over index.html?

The PHP interpreter will immediately hand your output back to your web server if there is absolutely no PHP code in it (all it does is send some engine-specific headers), so the performance difference is negligible if at all existent.


You should use index.html, and then if you decide you need PHP, create an index.php, and change your DirectoryIndex directive (if you're using Apache).


on most webservers ".html" files will not get parsed with the php interpreter. so i think, yes, there is an speed advantage.

i use .html files for very small sites, without anything special, shure, why not. the will never get updated so there is no need for it.


Of course...if u have static site u know that u wont have PHP code. i guess that for .php files the server has to parse the file even if it doesnt contain any php tags or code, but i think that its really negligible...


For sure, the main topic's answer is that if you don't need anything in PHP for your site, you can use .html/.htm in the index page - as everybody stated.

But sometimes, I use it as a awesome trick: when I want to update some webpages or I want to fix some issue within the site or even say something for the visitors, I do an upload of an index.html page saying what I want. Note that, in this case, You will need to always use index.php for the site itself - the trick will work for sure.

Of course, your server need to accept PHP files :P

I hope I helped!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜