2
0
Fork 0
mirror of https://github.com/phanan/htaccess.git synced 2018-11-08 13:39:40 +01:00

Merge branch 'lukedmor-prevent-download'

This commit is contained in:
An Phan 2015-02-11 11:17:35 +08:00
commit 30ee04ec23

View file

@ -38,6 +38,7 @@ What I'm doing here is mostly collecting useful snippets from all over the inter
- [Set PHP Variables](#set-php-variables)
- [Custom Error Pages](#custom-error-pages)
- [Force Downloading](#force-downloading)
- [Prevent Downloading](#prevent-downloading)
- [Allow Cross-Domain Fonts](#allow-cross-domain-fonts)
- [Auto UTF-8 Encode](#auto-utf-8-encode)
- [Switch to Another PHP Version](#switch-to-another-php-version)
@ -343,6 +344,14 @@ Sometimes you want to force the browser to download some content instead of disp
</Files>
```
### Prevent Downloading
Sometimes you want to force the browser to display some content instead of downloading it. The following snippet will help.
``` apacheconf
<FilesMatch "\.(tex|log|aux)$">
Header set Content-Type text/plain
</FilesMatch>
```
### Allow Cross-Domain Fonts
CDN-served webfonts might not work in Firefox or IE due to [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). The following snippet from [alrra](https://github.com/h5bp/server-configs-apache/issues/32) should make it happen.
``` apacheconf