Skip to content

Commit

Permalink
404 document. lots of .htaccess work
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Jul 30, 2010
1 parent d9077f2 commit 0b140cf
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 17 deletions.
80 changes: 63 additions & 17 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html

# http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
# Techniques in here adapted from all over,
# including Kroc Camen: camendesign.com/.htaccess





# hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
# Disabled. Uncomment to serve cross-domain ajax requests
#<IfModule mod_headers.c>
# Header set Access-Control-Allow-Origin "*"
Expand All @@ -24,8 +33,11 @@
AddType image/svg+xml svg svgz

# Proper app cache serving.
# http://diveintohtml5.org/offline.html#manifest
AddType text/cache-manifest manifest
<FilesMatch "\.manifest$">
ExpiresActive On
ExpiresDefault "access"
</FilesMatch>

# video
AddType video/ogg ogg ogv
Expand Down Expand Up @@ -71,23 +83,37 @@ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application
# <script src="application.js?20100608">
# if you don't do that, lower the css and js to
# "access plus 1 week" or so

<IfModule mod_expires.c>
ExpiresActive On

# images
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"

# favicon.ico
ExpiresByType image/vnd.microsoft.icon "access plus 1 week"

Header set cache-control: public
ExpiresActive on
ExpiresDefault "access plus 1 month"

# your document html (Last Modified should be fine)
# ExpiresByType text/html "access plus 1 hour"

# rss feed
ExpiresByType application/rss+xml "access plus 1 hour"

# favicon (cannot be renamed)
ExpiresByType image/vnd.microsoft.icon "access plus 1 week"

# media: images, video, audio
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"

# webfonts
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"

# css and javascript
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
</IfModule>


Expand All @@ -102,3 +128,23 @@ ExpiresByType text/javascript "access plus 1 year"
# </Location>
# </IfModule>


# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist (e.g. “/blog/hello”)
# <webmasterworld.com/apache/3808792.htm>
Options -MultiViews
# -Indexes will have Apache block users from browsing folders without a default document
# Options -Indexes



# custom 404 page
ErrorDocument 404 /404.html



# force utf-8 for a number of file formats:
AddDefaultCharset utf-8
AddCharset utf-8 .html .css .js .xml



19 changes: 19 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<title>not found</title>

<style>
body { text-align: center;}
h1 { font-size: 50px; }
body { font: 20px Constantia, 'Hoefler Text', "Adobe Caslon Pro", Baskerville, Georgia, Times, serif; color: #999; text-shadow: 2px 2px 2px rgba(200, 200, 200, 0.5)}
a { color: rgb(36, 109, 56); text-decoration:none; }
a:hover { color: rgb(96, 73, 141) ; text-shadow: 2px 2px 2px rgba(36, 109, 56, 0.5) }
span[frown] { transform: rotate(90deg); display:inline-block; color: #bbb; }
</style>




<details>
<summary><h1>Not found</h1></summary>
<p><span frown>:(</p>
</details>

0 comments on commit 0b140cf

Please sign in to comment.