puissanceweb/WP-Skeleton/master/config/samples/SAMPLE.htaccess - Htaccess File

puissanceweb/WP-Skeleton/master/config/samples/SAMPLE.htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteBase "/${server.pathname}"

  #Fix issue #1 invalid wp-admin redirect
  RewriteRule ^wp-admin$ /wp-admin/ [L,R=301]

  #If the URL start with public stop redirect
  RewriteRule wp-cms/index.php$ - [L]

  #If you request an URL it does not start with wp-cms
  #Else the HTACCESS have done the redirect, you can go to the index.php to execute code
  RewriteCond %{REQUEST_URI} ^/wp-cms
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /wp-cms/index.php [L]

  #wp-cms is not here so we add it :)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /wp-cms/$1 [L]
</IfModule>

########################### MOD_DEFLATE COMPRESSION ############################
# TODO fixme :  -> KO in localhost with chrome and wordpress 4.3
#<IfModule mod_deflate.c>
#  SetOutputFilter DEFLATE
#  AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
# </IfModule>

#For incompatible browsers
# BrowserMatch ^Mozilla/4 gzip-only-text/html
# BrowserMatch ^Mozilla/4.0[678] no-gzip
# BrowserMatch bMSIE !no-gzip !gzip-only-text/html
# BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html

#Do not put in cache if files are already in
#SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|swf)$ no-gzip
################################ EXPIRE HEADERS ################################
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 7200 seconds"
  ExpiresByType image/jpg "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"

  AddType image/x-icon .ico
  ExpiresByType image/ico "access plus 2592000 seconds"
  ExpiresByType image/icon "access plus 2592000 seconds"
  ExpiresByType image/x-icon "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 2592000 seconds"
  ExpiresByType text/javascript "access plus 2592000 seconds"
  ExpiresByType text/html "access plus 7200 seconds"
  ExpiresByType application/xhtml+xml "access plus 7200 seconds"
  ExpiresByType application/javascript A259200
  ExpiresByType application/x-javascript "access plus 2592000 seconds"
  ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>

############################ CACHE CONTROL HEADERS #############################
<IfModule mod_headers.c>
  #les proxies doivent donner le bon contenu
  Header append Vary User-Agent env=!dont-vary

  <FilesMatch "\.(ico|jpe?g|png|gif|swf|gz|ttf)$">
    Header set Cache-Control "max-age=2592000, public"
  </FilesMatch>
  <FilesMatch "\.(css)$">
    Header set Cache-Control "max-age=2592000, public"
  </FilesMatch>
  <FilesMatch "\.(js)$">
    Header set Cache-Control "max-age=2592000, private"
  </FilesMatch>
  <FilesMatch "\.(html|htm)$">
    Header set Cache-Control "max-age=7200, public"
  </FilesMatch>

  # Disable caching for scripts and other dynamic files
  <FilesMatch ".(pl|php|cgi|spl|scgi|fcgi)$">
    Header unset Cache-Control
  </FilesMatch>

  # KILL THEM ETAGS
  Header unset ETag
  FileETag none
</IfModule>

############################ CONFIG PERSO  #############################
# 
#a-Register_Globals sur OFF:
#
SetEnv REGISTER_GLOBALS 0 

############################ PROTECT HTACCESS FILE #############################
#b-Interdire l'accès à ce fichier depuis un navigateur web:
#
<Files .htaccess>
order allow,deny
deny from all
</Files>

# Stop Apache from serving .ht* files
<Files  ~ "^.ht">
order allow,deny
deny from all
</Files>

############################ PROTECT FOLDER LISTING ############################
#c-Interdire de lister le contenu d'un dossier
#
Options All -Indexes

#d voir plus bas -> option désactivée

#e-interdire l'acces au fichier de config WP : wp-config.php
#
<files wp-config.php>
order allow,deny
deny from all
</files>

<files wp-local-config.php>
order allow,deny
deny from all
</files>

On Github License

Files

Download PDF of Htaccess file
CACHE, DEFLATE, no-gzip, REQUEST_FILENAME, REQUEST_URI

Comments

Apache