|
| 1 | +<IfModule mod_rewrite.c> |
| 2 | + RewriteEngine On |
| 3 | + |
| 4 | + RewriteBase "/" |
| 5 | + |
| 6 | + #Fix issue #1 invalid wp-admin redirect |
| 7 | + RewriteRule ^wp\-admin$ /wp-admin/ [L,R=301] |
| 8 | + |
| 9 | + #If the URL start with public stop redirect |
| 10 | + RewriteRule wp\-cms\/index\.php$ - [L] |
| 11 | + |
| 12 | + #If you request an URL it does not start with wp-cms |
| 13 | + #Else the HTACCESS have done the redirect, you can go to the index.php to execute code |
| 14 | + RewriteCond %{REQUEST_URI} ^/wp-cms |
| 15 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 16 | + RewriteCond %{REQUEST_FILENAME} !-d |
| 17 | + RewriteRule ^(.*)$ /wp-cms/index.php [L] |
| 18 | + |
| 19 | + #wp-cms is not here so we add it :) |
| 20 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 21 | + RewriteCond %{REQUEST_FILENAME} !-d |
| 22 | + RewriteRule ^(.*)$ /wp-cms/$1 [L] |
| 23 | +</IfModule> |
| 24 | + |
| 25 | +########################### MOD_DEFLATE COMPRESSION ############################ |
| 26 | +<IfModule mod_deflate.c> |
| 27 | + SetOutputFilter DEFLATE |
| 28 | + AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php |
| 29 | +</IfModule> |
| 30 | + |
| 31 | +#For incompatible browsers |
| 32 | +BrowserMatch ^Mozilla/4 gzip-only-text/html |
| 33 | +BrowserMatch ^Mozilla/4\.0[678] no-gzip |
| 34 | +BrowserMatch \bMSIE !no-gzip !gzip-only-text/html |
| 35 | +BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html |
| 36 | + |
| 37 | +#Do not put in cache if files are already in |
| 38 | +SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf)$ no-gzip |
| 39 | + |
| 40 | +################################ EXPIRE HEADERS ################################ |
| 41 | +<IfModule mod_expires.c> |
| 42 | + ExpiresActive On |
| 43 | + ExpiresDefault "access plus 7200 seconds" |
| 44 | + ExpiresByType image/jpg "access plus 2592000 seconds" |
| 45 | + ExpiresByType image/jpeg "access plus 2592000 seconds" |
| 46 | + ExpiresByType image/png "access plus 2592000 seconds" |
| 47 | + ExpiresByType image/gif "access plus 2592000 seconds" |
| 48 | + |
| 49 | + AddType image/x-icon .ico |
| 50 | + ExpiresByType image/ico "access plus 2592000 seconds" |
| 51 | + ExpiresByType image/icon "access plus 2592000 seconds" |
| 52 | + ExpiresByType image/x-icon "access plus 2592000 seconds" |
| 53 | + ExpiresByType text/css "access plus 2592000 seconds" |
| 54 | + ExpiresByType text/javascript "access plus 2592000 seconds" |
| 55 | + ExpiresByType text/html "access plus 7200 seconds" |
| 56 | + ExpiresByType application/xhtml+xml "access plus 7200 seconds" |
| 57 | + ExpiresByType application/javascript A259200 |
| 58 | + ExpiresByType application/x-javascript "access plus 2592000 seconds" |
| 59 | + ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds" |
| 60 | +</IfModule> |
| 61 | + |
| 62 | +############################ CACHE CONTROL HEADERS ############################# |
| 63 | +<IfModule mod_headers.c> |
| 64 | + #les proxies doivent donner le bon contenu |
| 65 | + Header append Vary User-Agent env=!dont-vary |
| 66 | + |
| 67 | + <FilesMatch "\\.(ico|jpe?g|png|gif|swf|gz|ttf)$"> |
| 68 | + Header set Cache-Control "max-age=2592000, public" |
| 69 | + </FilesMatch> |
| 70 | + <FilesMatch "\\.(css)$"> |
| 71 | + Header set Cache-Control "max-age=2592000, public" |
| 72 | + </FilesMatch> |
| 73 | + <FilesMatch "\\.(js)$"> |
| 74 | + Header set Cache-Control "max-age=2592000, private" |
| 75 | + </FilesMatch> |
| 76 | + <FilesMatch "\\.(html|htm)$"> |
| 77 | + Header set Cache-Control "max-age=7200, public" |
| 78 | + </FilesMatch> |
| 79 | + |
| 80 | + # Disable caching for scripts and other dynamic files |
| 81 | + <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$"> |
| 82 | + Header unset Cache-Control |
| 83 | + </FilesMatch> |
| 84 | + |
| 85 | + # KILL THEM ETAGS |
| 86 | + Header unset ETag |
| 87 | + FileETag none |
| 88 | +</IfModule> |
| 89 | + |
| 90 | +############################ PROTECT HTACCESS FILE ############################# |
| 91 | +<Files .htaccess> |
| 92 | + Order allow,deny |
| 93 | + Deny from all |
| 94 | +</Files> |
| 95 | +<Files wp-config.php> |
| 96 | + Order allow,deny |
| 97 | + Deny from all |
| 98 | +</Files> |
| 99 | + |
| 100 | +############################ PROTECT FOLDER LISTING ############################ |
| 101 | +Options -Indexes |
0 commit comments