REMEMBER:<\/strong> The .zip file might appear to be empty, but it’s not. The files are all prefaced with a dot. View them in a file editor which shows you “hidden” files. <\/p>\n<\/p>\n
Special thanks to Cliff White.<\/p>\n
Update November 2012: The demo and downloadable files have been updated to (1) show more human readable file sizes (2) have error pages<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"
Servers can be configured to show the contents of a directory that doesn’t have an index file to render. The result is usually less than visually spectacular: Lackluster default in Chrome More better, View Demo We can take control of this ourselves by replicating this functionality with PHP. Make an index file (.index.php, starting with […]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":3233,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-snippet.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":""},"tags":[],"acf":[],"jetpack-related-posts":[{"id":3942,"url":"https:\/\/css-tricks.com\/snippets\/htaccess\/different-directory-index-page\/","url_meta":{"origin":4482,"position":0},"title":"Different Directory Index Page","date":"September 8, 2009","format":false,"excerpt":"Normally index.html or index.php is the default page a server serves up when visiting a directory without specifying a file name. You can change this with .htaccess: DirectoryIndex index2.html","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4232,"url":"https:\/\/css-tricks.com\/snippets\/htaccess\/password-protect-folders\/","url_meta":{"origin":4482,"position":1},"title":"Password Protect Folder(s)","date":"September 25, 2009","format":false,"excerpt":"Put in .htaccess file in the directory you are trying to protect: AuthType Basic AuthName \"This Area is Password Protected\" AuthUserFile \/full\/path\/to\/.htpasswd Require valid-user Ideally, the .htpasswd file will be not in a public facing directory. Put this in there: chriscoyier:$apr1$O\/BJv...$vIHV9Q7ySPkw6Mv6Kd\/ZE\/ That is just a sample, you can create the\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4922,"url":"https:\/\/css-tricks.com\/snippets\/php\/increase-maximum-php-upload-size\/","url_meta":{"origin":4482,"position":2},"title":"Increase Maximum PHP Upload Size","date":"December 3, 2009","format":false,"excerpt":"Many shared hosts put very low restrictions on the size of the files that can be uploaded through PHP. But, many hosts also allow you to create your own php.ini file in the root directory of your site. This file can override some of the servers default PHP settings. If\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":207270,"url":"https:\/\/css-tricks.com\/snippets\/html\/start-a-web-server-with-one-terminal-command-on-os-x\/","url_meta":{"origin":4482,"position":3},"title":"Start a Web Server With One Terminal Command on OS X","date":"August 27, 2015","format":false,"excerpt":"I've searched for this three times this week, so I figured I'd better make sure I have a copy of it. Python 2: python -m SimpleHTTPServer 8000 Navigate to the project directory in the terminal and do that command. Then http:\/\/localhost:8000 will server up that directory (as in, it's `index.html`\u2026","rel":"","context":"In \"php\"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4030,"url":"https:\/\/css-tricks.com\/snippets\/htaccess\/force-favicon-requests-to-correct-location\/","url_meta":{"origin":4482,"position":4},"title":"Force Favicon Requests to Correct Location","date":"September 11, 2009","format":false,"excerpt":"For whatever crazy reason, perhaps evil-doing site scanners, requets to a web server for a favicon in all known crevasses of the site are fairly common. Since that file probably only actually exists in the root directory of your site, these requests result in a 404. If you server up\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16899,"url":"https:\/\/css-tricks.com\/snippets\/php\/create-data-uris\/","url_meta":{"origin":4482,"position":5},"title":"Create Data URI’s","date":"May 1, 2012","format":false,"excerpt":"These can be useful for embedding images into HTML\/CSS\/JS to save on HTTP requests, at the cost of maintainability. More information. There are online tools to do it, but if you want your own very simple utility, here's some PHP to do it: function data_uri($file, $mime) { $contents=file_get_contents($file); $base64=base64_encode($contents); echo\u2026","rel":"","context":"With 6 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4482"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=4482"}],"version-history":[{"count":11,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4482\/revisions"}],"predecessor-version":[{"id":275558,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4482\/revisions\/275558"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3233"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=4482"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=4482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}