Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizations #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 53 additions & 57 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
##### Necessary redirects and rewrites for search engines #####

<IfModule mod_rewrite.c>
#RewriteCond %{HTTP_HOST} !^www.yourdomain.com$ [NC]
#RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
##### Redirect away from /index.php and /home
##### Warning: This index.php rewrite will prevent Magento
##### Connect from working. Simply comment out the
##### following two lines of code when using Connect.
##### Please note - http://www. if not using www simply use http://
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.yourdomain.com/$1 [R=301,L]
##### Please note - http://www. if not using www simply use http://
redirect 301 /home http://www.yourdomain.com

##### rewrite index.php to /
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

##### rewrite index.html
Redirect 301 /index.html /

##### rewrite /?home to /
RewriteCond %{THE_REQUEST} \?([^&\ ]+)?home [NC]
RewriteRule ^ %{REQUEST_URI}?%1 [L,R=301]

##### rewrite /home to /
Redirect 301 /home /

Options +FollowSymLinks
RewriteEngine on
Expand All @@ -56,10 +56,20 @@
</IfModule>


##### Enable apache served files compression #####
##### mod_deflate compresses your output to lower the file size being sent to the client #####

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Expand All @@ -72,6 +82,19 @@
SetOutputFilter DEFLATE
</Files>

##### Mod gzip and caching for improved site speed #####

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<IfModule mod_ssl.c>
SSLOptions StdEnvVars
</IfModule>
Expand All @@ -82,51 +105,31 @@
<ifModule mod_headers.c>
Header unset ETag
Header unset Last-Modified
</ifModule>

##### Web fonts access #####
<FilesMatch "\.(eot|otf|tt[cf]|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>

##### Force IE8 compatibility when using IE8
Header set X-UA-Compatible "IE=edge"

##### `mod_headers` cannot match based on the content-type, however, this
##### header should be send only for HTML pages and not for the other resources
<FilesMatch "\.(appcache|atom|crx|css|cur|eot|f4[abpv]|flv|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|tt[cf]|vcf|vtt|webapp|web[mp]|woff|xml|xpi)$">
Header unset X-UA-Compatible
</FilesMatch>

</IfModule>

##### disable POST processing to not break multiple image upload #####

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>


##### Enable apache served files compression #####

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</IfModule>


##### Mod gzip and caching for improved site speed #####

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>


##### Default expires headers for all file types #####
##### Not recommended for development environment #####

Expand Down Expand Up @@ -208,13 +211,6 @@
#AddDefaultCharset UTF-8


##### Force IE8 compatibility when using IE8+ #####
##### May cause issues within Windows Mobile Browsers #####

BrowserMatch MSIE best-standards-support
Header set X-UA-Compatible IE=8 env=best-standards-support


##### By default allow all access #####

Order allow,deny
Expand Down