Advertisement
nicolascluz

wordpress apache .htaccess base

Jul 30th, 2013
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. # BEGIN WordPress
  2. <IfModule mod_rewrite.c>
  3. RewriteEngine On
  4. RewriteBase /
  5. RewriteRule ^index\.php$ - [L]
  6. RewriteCond %{REQUEST_FILENAME} !-f
  7. RewriteCond %{REQUEST_FILENAME} !-d
  8. RewriteRule . /index.php [L]
  9. </IfModule>
  10.  
  11. # Protect WP-config.php
  12. <files wp-config.php>
  13. order allow,deny
  14. deny from all
  15. </files>
  16.  
  17. # Protect .htaccess file
  18. <files ~ "^.*\.([Hh][Tt][Aa])">
  19. order allow,deny
  20. deny from all
  21. </files>
  22.  
  23. # Protect comments.php
  24. RewriteCond %{REQUEST_METHOD} POST
  25. RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
  26. RewriteCond %{HTTP_REFERER} !.*http://mabulledu.net.* [OR]
  27. RewriteCond %{HTTP_USER_AGENT} ^$
  28. RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
  29.  
  30. # mod_deflate
  31. <IfModule mod_deflate.c>
  32. AddOutputFilterByType DEFLATE text/plain
  33. AddOutputFilterByType DEFLATE text/html
  34. AddOutputFilterByType DEFLATE text/xml
  35. AddOutputFilterByType DEFLATE text/css
  36. AddOutputFilterByType DEFLATE application/xml
  37. AddOutputFilterByType DEFLATE application/xhtml+xml
  38. AddOutputFilterByType DEFLATE application/rss+xml
  39. AddOutputFilterByType DEFLATE application/javascript
  40. AddOutputFilterByType DEFLATE application/x-javascript
  41. AddOutputFilterByType DEFLATE application/x-httpd-php
  42. AddOutputFilterByType DEFLATE application/x-httpd-fastphp
  43. AddOutputFilterByType DEFLATE image/svg+xml
  44. </IfModule>
  45. # mod_deflate
  46.  
  47. #Turn ETagging off
  48. FileETag none
  49. #
  50. #Force caching of some common files for some time in the browser's cache, to save bandwidth.
  51. #"Mod_expires" needs to be installed in your Apache server, to use this feature
  52. # BEGIN Expire headers
  53. <ifModule mod_expires.c>
  54. ExpiresActive On
  55. ExpiresDefault "access plus 5 seconds"
  56. ExpiresByType image/x-icon "access plus 2592000 seconds"
  57. ExpiresByType image/jpeg "access plus 2592000 seconds"
  58. ExpiresByType image/png "access plus 2592000 seconds"
  59. ExpiresByType image/gif "access plus 2592000 seconds"
  60. ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
  61. ExpiresByType text/css "access plus 604800 seconds"
  62. ExpiresByType text/javascript "access plus 216000 seconds"
  63. ExpiresByType application/javascript "access plus 216000 seconds"
  64. ExpiresByType application/x-javascript "access plus 216000 seconds"
  65. ExpiresByType text/html "access plus 600 seconds"
  66. ExpiresByType application/xhtml+xml "access plus 600 seconds"
  67. </ifModule>
  68. # END Expire headers
  69.  
  70. # BEGIN Cache-Control Headers
  71. <ifModule mod_headers.c>
  72. <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
  73. Header set Cache-Control "public"
  74. </filesMatch>
  75. <filesMatch "\.(css)$">
  76. Header set Cache-Control "public"
  77. </filesMatch>
  78. <filesMatch "\.(js)$">
  79. Header set Cache-Control "private"
  80. </filesMatch>
  81. <filesMatch "\.(x?html?|php)$">
  82. Header set Cache-Control "private, must-revalidate"
  83. </filesMatch>
  84. </ifModule>
  85. # END Cache-Control Headers
  86. # END WordPress
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement