Skip to content

Instantly share code, notes, and snippets.

@fana605
Last active August 3, 2021 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fana605/1e39f5f539733ca6a992dc6d99a15b77 to your computer and use it in GitHub Desktop.
Save fana605/1e39f5f539733ca6a992dc6d99a15b77 to your computer and use it in GitHub Desktop.
Force htaccess https Dreamhost
<IfModule mod_rewrite.c>
# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#AllowOverride All
#RewriteBase /wherever/website/is
RedirectMatch 403 ^/(system|application).*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
</IfModule>
<files .htaccess>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</files>
# Disable server signature start
ServerSignature Off
# Disable server signature end
# gzip compression
<IfModule mod_deflate.c>
<FilesMatch "\.(php|html|css|js)$">
SetOutputFilter DEFLATE
</FilesMatch>
# compress content with type html, text, and css
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript application/javascript
<ifmodule mod_headers.c>
# properly handle requests coming from behind proxies
Header append Vary User-Agent
</ifmodule>
# webfonts and svg:
<FilesMatch "\.(ttf|otf|eot|svg)$" >
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
AddType application/vnd.ms-fontobject .eot
AddType application/font-woff .woff
AddType application/x-font-truetype .ttf
AddType image/svg+xml .svg
AddType application/x-font-opentype .otf
## EXPIRES CACHING ##
<IfModule mod_expires.c>
#ExpiresActive On
#ExpiresByType image/jpg "access 1 year"
#ExpiresByType image/jpeg "access 1 year"
#ExpiresByType image/gif "access 1 year"
#ExpiresByType image/png "access 1 year"
#ExpiresByType image/svg+xml "access 1 year"
#ExpiresByType text/css "access 1 year"
#ExpiresByType text/html "access 1 year"
#ExpiresByType application/pdf "access 1 year"
#ExpiresByType text/x-javascript "access 1 year"
#ExpiresByType application/x-shockwave-flash "access 1 year"
#ExpiresByType image/x-icon "access 1 year"
#ExpiresDefault "access 1 year"
</IfModule>
## EXPIRES CACHING ##
FileETag None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment