Skip to content

Instantly share code, notes, and snippets.

@m1g0r
Forked from jonathonbyrdziak/.htaccess
Last active January 17, 2018 19:51
Show Gist options
  • Save m1g0r/23f9931cbbac525e23b5645419894df8 to your computer and use it in GitHub Desktop.
Save m1g0r/23f9931cbbac525e23b5645419894df8 to your computer and use it in GitHub Desktop.

Revisions

  1. m1g0r renamed this gist Jan 17, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. m1g0r renamed this gist Jan 17, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @jonathonbyrdziak jonathonbyrdziak revised this gist Dec 22, 2014. 1 changed file with 0 additions and 217 deletions.
    217 changes: 0 additions & 217 deletions .htaccess.magento
    Original file line number Diff line number Diff line change
    @@ -1,217 +0,0 @@
    ############################################
    #
    # The Original HTACCESS file for Magento
    # provided by The Magento Support Center
    #
    # http://magentosupport.help


    ############################################
    ## uncomment these lines for CGI mode
    ## make sure to specify the correct cgi php binary file name
    ## it might be /cgi-bin/php-cgi

    # Action php5-cgi /cgi-bin/php5-cgi
    # AddHandler php5-cgi .php

    ############################################
    ## GoDaddy specific options

    # Options -MultiViews

    ## you might also need to add this line to php.ini
    ## cgi.fix_pathinfo = 1
    ## if it still doesn't work, rename php.ini to php5.ini

    ############################################
    ## this line is specific for 1and1 hosting

    #AddType x-mapp-php5 .php
    #AddHandler x-mapp-php5 .php

    ############################################
    ## default index file

    DirectoryIndex index.php

    <IfModule mod_php5.c>

    ############################################
    ## adjust memory limit

    # php_value memory_limit 64M
    php_value memory_limit 256M
    php_value max_execution_time 18000

    ############################################
    ## disable magic quotes for php request vars

    php_flag magic_quotes_gpc off

    ############################################
    ## disable automatic session start
    ## before autoload was initialized

    php_flag session.auto_start off

    ############################################
    ## enable resulting html compression

    #php_flag zlib.output_compression on

    ###########################################
    # disable user agent verification to not break multiple image upload

    php_flag suhosin.session.cryptua off

    ###########################################
    # turn off compatibility with PHP4 when dealing with objects

    php_flag zend.ze1_compatibility_mode Off

    </IfModule>

    <IfModule mod_security.c>
    ###########################################
    # disable POST processing to not break multiple image upload

    SecFilterEngine Off
    SecFilterScanPOST Off
    </IfModule>

    <IfModule mod_deflate.c>

    ############################################
    ## enable apache served files compression
    ## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

    </IfModule>

    <IfModule mod_ssl.c>

    ############################################
    ## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

    </IfModule>

    <IfModule mod_rewrite.c>

    ############################################
    ## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

    ############################################
    ## you can put here your magento root folder
    ## path relative to web root

    #RewriteBase /magento/

    ############################################
    ## uncomment next line to enable light API calls processing

    # RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

    ############################################
    ## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

    ############################################
    ## workaround for HTTP authorization
    ## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    ############################################
    ## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

    ############################################
    ## redirect for mobile user agents

    #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
    #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

    ############################################
    ## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

    ############################################
    ## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

    ############################################
    ## rewrite everything else to index.php

    RewriteRule .* index.php [L]

    </IfModule>


    ############################################
    ## Prevent character encoding issues from server overrides
    ## If you still have problems, use the second line instead

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

    <IfModule mod_expires.c>

    ############################################
    ## Add default Expires header
    ## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresDefault "access plus 1 year"

    </IfModule>

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

    Order allow,deny
    Allow from all

    ###########################################
    ## Deny access to release notes to prevent disclosure of the installed Magento version

    <Files RELEASE_NOTES.txt>
    order allow,deny
    deny from all
    </Files>

    ############################################
    ## If running in cluster environment, uncomment this
    ## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag none
  4. @jonathonbyrdziak jonathonbyrdziak revised this gist Dec 22, 2014. 1 changed file with 217 additions and 0 deletions.
    217 changes: 217 additions & 0 deletions .htaccess.magento
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,217 @@
    ############################################
    #
    # The Original HTACCESS file for Magento
    # provided by The Magento Support Center
    #
    # http://magentosupport.help


    ############################################
    ## uncomment these lines for CGI mode
    ## make sure to specify the correct cgi php binary file name
    ## it might be /cgi-bin/php-cgi

    # Action php5-cgi /cgi-bin/php5-cgi
    # AddHandler php5-cgi .php

    ############################################
    ## GoDaddy specific options

    # Options -MultiViews

    ## you might also need to add this line to php.ini
    ## cgi.fix_pathinfo = 1
    ## if it still doesn't work, rename php.ini to php5.ini

    ############################################
    ## this line is specific for 1and1 hosting

    #AddType x-mapp-php5 .php
    #AddHandler x-mapp-php5 .php

    ############################################
    ## default index file

    DirectoryIndex index.php

    <IfModule mod_php5.c>

    ############################################
    ## adjust memory limit

    # php_value memory_limit 64M
    php_value memory_limit 256M
    php_value max_execution_time 18000

    ############################################
    ## disable magic quotes for php request vars

    php_flag magic_quotes_gpc off

    ############################################
    ## disable automatic session start
    ## before autoload was initialized

    php_flag session.auto_start off

    ############################################
    ## enable resulting html compression

    #php_flag zlib.output_compression on

    ###########################################
    # disable user agent verification to not break multiple image upload

    php_flag suhosin.session.cryptua off

    ###########################################
    # turn off compatibility with PHP4 when dealing with objects

    php_flag zend.ze1_compatibility_mode Off

    </IfModule>

    <IfModule mod_security.c>
    ###########################################
    # disable POST processing to not break multiple image upload

    SecFilterEngine Off
    SecFilterScanPOST Off
    </IfModule>

    <IfModule mod_deflate.c>

    ############################################
    ## enable apache served files compression
    ## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

    </IfModule>

    <IfModule mod_ssl.c>

    ############################################
    ## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

    </IfModule>

    <IfModule mod_rewrite.c>

    ############################################
    ## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

    ############################################
    ## you can put here your magento root folder
    ## path relative to web root

    #RewriteBase /magento/

    ############################################
    ## uncomment next line to enable light API calls processing

    # RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

    ############################################
    ## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

    ############################################
    ## workaround for HTTP authorization
    ## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    ############################################
    ## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

    ############################################
    ## redirect for mobile user agents

    #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
    #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

    ############################################
    ## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

    ############################################
    ## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

    ############################################
    ## rewrite everything else to index.php

    RewriteRule .* index.php [L]

    </IfModule>


    ############################################
    ## Prevent character encoding issues from server overrides
    ## If you still have problems, use the second line instead

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

    <IfModule mod_expires.c>

    ############################################
    ## Add default Expires header
    ## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresDefault "access plus 1 year"

    </IfModule>

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

    Order allow,deny
    Allow from all

    ###########################################
    ## Deny access to release notes to prevent disclosure of the installed Magento version

    <Files RELEASE_NOTES.txt>
    order allow,deny
    deny from all
    </Files>

    ############################################
    ## If running in cluster environment, uncomment this
    ## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag none
  5. @jonathonbyrdziak jonathonbyrdziak revised this gist Dec 19, 2014. 1 changed file with 25 additions and 0 deletions.
    25 changes: 25 additions & 0 deletions .htaccess
    Original file line number Diff line number Diff line change
    @@ -188,3 +188,28 @@ FileETag None
    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
    </IfModule>


    # ------------------------------------------------------------------------------
    # | GZip Compression (for faster page transfers) |
    # ------------------------------------------------------------------------------

    # GZip Compression
    # compress text, html, javascript, css, xml:
    #
    <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
    </IfModule>

    # Limit bandwidth consumption
    <IfModule mod_php5.c>
    php_value zlib.output_compression 16386
    </IfModule>
  6. @jonathonbyrdziak jonathonbyrdziak renamed this gist Dec 19, 2014. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions .htaccess → .htaccess
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,14 @@
    # ------------------------------------------------------------------------------
    #
    # Curtousy of the Magento Support Center
    # http://magentosupport.help/what-are-expires-headers-and-how-do-i-implement-them/
    #
    # ------------------------------------------------------------------------------


    # ------------------------------------------------------------------------------
    # | Mod Caching via Apache |
    # ------------------------------------------------------------------------------

    <IfModule mod_cache.c>
    <IfModule mod_mem_cache.c>
  7. @jonathonbyrd jonathonbyrd revised this gist Sep 14, 2013. 1 changed file with 24 additions and 4 deletions.
    28 changes: 24 additions & 4 deletions .htaccess
    Original file line number Diff line number Diff line change
    @@ -152,8 +152,28 @@ FileETag None
    </IfModule>


    <ifModule mod_deflate.c>
    <filesMatch "\.(css|js|x?html?|php)$">
    <IfModule mod_deflate.c>
    ############################################
    ## enable apache served files compression
    ## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    SetOutputFilter DEFLATE
    </filesMatch>
    </ifModule>
    # Insert filter on selected content types only
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
    </IfModule>
  8. @jonathonbyrd jonathonbyrd created this gist Sep 14, 2013.
    159 changes: 159 additions & 0 deletions .htaccess
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,159 @@

    <IfModule mod_cache.c>
    <IfModule mod_mem_cache.c>
    CacheEnable mem /
    MCacheSize 4096
    MCacheMaxObjectCount 100
    MCacheMinObjectSize 1
    MCacheMaxObjectSize 2048
    </IfModule>
    </IfModule>


    # ------------------------------------------------------------------------------
    # | Proper MIME types for all files |
    # ------------------------------------------------------------------------------

    <IfModule mod_mime.c>

    # Audio
    AddType audio/mp4 m4a f4a f4b
    AddType audio/ogg oga ogg

    # JavaScript
    # Normalize to standard type (it's sniffed in IE anyways):
    # http://tools.ietf.org/html/rfc4329#section-7.2
    AddType application/javascript js jsonp
    AddType application/json json

    # Video
    AddType video/mp4 mp4 m4v f4v f4p
    AddType video/ogg ogv
    AddType video/webm webm
    AddType video/x-flv flv

    # Web fonts
    AddType application/font-woff woff
    AddType application/vnd.ms-fontobject eot

    # Browsers usually ignore the font MIME types and sniff the content,
    # however, Chrome shows a warning if other MIME types are used for the
    # following fonts.
    AddType application/x-font-ttf ttc ttf
    AddType font/opentype otf

    # Make SVGZ fonts work on iPad:
    # https://twitter.com/FontSquirrel/status/14855840545
    AddType image/svg+xml svg svgz
    AddEncoding gzip svgz

    # Other
    AddType application/octet-stream safariextz
    AddType application/x-chrome-extension crx
    AddType application/x-opera-extension oex
    AddType application/x-shockwave-flash swf
    AddType application/x-web-app-manifest+json webapp
    AddType application/x-xpinstall xpi
    AddType application/xml atom rdf rss xml
    AddType image/webp webp
    AddType image/x-icon ico
    AddType text/cache-manifest appcache manifest
    AddType text/vtt vtt
    AddType text/x-component htc
    AddType text/x-vcard vcf

    </IfModule>


    # ------------------------------------------------------------------------------
    # | ETag removal |
    # ------------------------------------------------------------------------------

    # Since we're sending far-future expires headers (see below), ETags can
    # be removed: http://developer.yahoo.com/performance/rules.html#etags.

    # `FileETag None` is not enough for every server.
    <IfModule mod_headers.c>
    Header unset ETag

    <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
    </filesMatch>
    <filesMatch "\.(css)$">
    Header set Cache-Control "max-age=604800, public"
    </filesMatch>
    <filesMatch "\.(js)$">
    Header set Cache-Control "max-age=216000, private"
    </filesMatch>
    <filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "max-age=600, private, must-revalidate"
    </filesMatch>
    </IfModule>

    FileETag None

    # ------------------------------------------------------------------------------
    # | Expires headers (for better cache control) |
    # ------------------------------------------------------------------------------

    # The following expires headers are set pretty far in the future. If you don't
    # control versioning with filename-based cache busting, consider lowering the
    # cache time for resources like CSS and JS to something like 1 week.

    <IfModule mod_expires.c>

    ExpiresActive on
    ExpiresDefault "access plus 1 month"

    # CSS
    ExpiresByType text/css "access plus 1 year"

    # Data interchange
    ExpiresByType application/json "access plus 0 seconds"
    ExpiresByType application/xml "access plus 0 seconds"
    ExpiresByType text/xml "access plus 0 seconds"

    # Favicon (cannot be renamed!)
    ExpiresByType image/x-icon "access plus 1 week"

    # HTML components (HTCs)
    ExpiresByType text/x-component "access plus 1 month"

    # HTML
    ExpiresByType text/html "access plus 0 seconds"

    # JavaScript
    ExpiresByType application/javascript "access plus 1 year"

    # Manifest files
    ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
    ExpiresByType text/cache-manifest "access plus 0 seconds"

    # Media
    ExpiresByType audio/ogg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType video/mp4 "access plus 1 month"
    ExpiresByType video/ogg "access plus 1 month"
    ExpiresByType video/webm "access plus 1 month"

    # Web feeds
    ExpiresByType application/atom+xml "access plus 1 hour"
    ExpiresByType application/rss+xml "access plus 1 hour"

    # Web fonts
    ExpiresByType application/font-woff "access plus 1 month"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    ExpiresByType application/x-font-ttf "access plus 1 month"
    ExpiresByType font/opentype "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"

    </IfModule>


    <ifModule mod_deflate.c>
    <filesMatch "\.(css|js|x?html?|php)$">
    SetOutputFilter DEFLATE
    </filesMatch>
    </ifModule>