Advertisement
Guest User

Untitled

a guest
May 13th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.74 KB | None | 0 0
  1.  
  2.  
  3. #
  4. # Apache/PHP/Drupal settings:
  5. #
  6.  
  7. # Protect files and directories from prying eyes.
  8. <FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(|~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
  9. Order deny,allow
  10. </FilesMatch>
  11.  
  12. # Don't show directory listings for URLs which map to a directory.
  13. Options -Indexes
  14.  
  15. # Follow symbolic links in this directory.
  16. Options +FollowSymLinks
  17.  
  18. # Make Drupal handle any 404 errors.
  19. ErrorDocument 404 /index.php
  20.  
  21. # Set the default handler.
  22. DirectoryIndex index.php index.html index.htm
  23.  
  24. # Override PHP settings that cannot be changed at runtime. See
  25. # sites/default/default.settings.php and drupal_environment_initialize() in
  26. # includes/bootstrap.inc for settings that can be changed at runtime.
  27.  
  28. # PHP 5, Apache 1 and 2.
  29. <IfModule mod_php5.c>
  30. php_flag magic_quotes_gpc off
  31. php_flag magic_quotes_sybase off
  32. php_flag register_globals off
  33. php_flag session.auto_start off
  34. php_value mbstring.http_input pass
  35. php_value mbstring.http_output pass
  36. php_flag mbstring.encoding_translation off
  37. </IfModule>
  38.  
  39. # Requires mod_expires to be enabled.
  40. <IfModule mod_expires.c>
  41. # Enable expirations.
  42. ExpiresActive On
  43.  
  44. # Cache all files for 2 weeks after access (A).
  45. ExpiresDefault A1209600
  46.  
  47. <FilesMatch \.php$>
  48. # Do not allow PHP scripts to be cached unless they explicitly send cache
  49. # headers themselves. Otherwise all scripts would have to overwrite the
  50. # headers set by mod_expires if they want another caching behavior. This may
  51. # fail if an error occurs early in the bootstrap process, and it may cause
  52. # problems if a non-Drupal PHP file is installed in a subdirectory.
  53. ExpiresActive Off
  54. </FilesMatch>
  55. </IfModule>
  56.  
  57. # Various rewrite rules.
  58. <IfModule mod_rewrite.c>
  59. RewriteEngine on
  60.  
  61.  
  62. # Set "protossl" to "s" if we were accessed via https://. This is used later
  63. # if you enable "www." stripping or enforcement, in order to ensure that
  64. # you don't bounce between http and https.
  65. RewriteRule ^ - [E=protossl]
  66. RewriteCond %{HTTPS} on
  67. RewriteRule ^ - [E=protossl:s]
  68.  
  69. # Block access to "hidden" directories whose names begin with a period. This
  70. # includes directories used by version control systems such as Subversion or
  71. # Git to store control files. Files whose names begin with a period, as well
  72. # as the control files used by CVS, are protected by the FilesMatch directive
  73. # above.
  74. #
  75. # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  76. # not possible to block access to entire directories from .htaccess, because
  77. # <DirectoryMatch> is not allowed here.
  78. #
  79. # If you do not have mod_rewrite installed, you should remove these
  80. # directories from your webroot or otherwise protect them from being
  81. # downloaded.
  82.  
  83.  
  84. # If your site can be accessed both with and without the 'www.' prefix, you
  85. # can use one of the following settings to redirect users to your preferred
  86. # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  87. #
  88. # To redirect all users to access the site WITH the 'www.' prefix,
  89. # (http://example.com/... will be redirected to http://www.example.com/...)
  90. # uncomment the following:
  91. RewriteCond %{HTTP_HOST} .
  92. RewriteCond %{HTTP_HOST} !^www\. [NC]
  93. RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  94.  
  95. #
  96. # To redirect all users to access the site WITHOUT the 'www.' prefix,
  97. # (http://www.example.com/... will be redirected to http://example.com/...)
  98. # uncomment the following:
  99. # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  100. # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
  101.  
  102. # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  103. # VirtualDocumentRoot and the rewrite rules are not working properly.
  104. # For example if your site is at http://example.com/drupal uncomment and
  105. # modify the following line:
  106. # RewriteBase /drupal
  107.  
  108. #
  109. # If your site is running in a VirtualDocumentRoot at http://example.com/,
  110. # uncomment the following line:
  111. RewriteBase /
  112.  
  113. #custom redirects
  114.  
  115.  
  116.  
  117.  
  118.  
  119. #end custom redirects
  120.  
  121.  
  122. # Pass all requests not referring directly to files in the filesystem to
  123. # index.php. Clean URLs are handled in drupal_environment_initialize().
  124. RewriteCond %{REQUEST_FILENAME} !-f
  125. RewriteCond %{REQUEST_FILENAME} !-d
  126. RewriteCond %{REQUEST_URI} !=/favicon.ico
  127. RewriteRule ^ index.php [L]
  128.  
  129. RewriteCond %{REQUEST_URI} /caribou
  130. RewriteRule ^ index.php [L]
  131.  
  132.  
  133.  
  134. # Rules to correctly serve gzip compressed CSS and JS files.
  135. # Requires both mod_rewrite and mod_headers to be enabled.
  136. <IfModule mod_headers.c>
  137. # Serve gzip compressed CSS files if they exist and the client accepts gzip.
  138. RewriteCond %{HTTP:Accept-encoding} gzip
  139. RewriteCond %{REQUEST_FILENAME}\.gz -s
  140. RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
  141.  
  142. # Serve gzip compressed JS files if they exist and the client accepts gzip.
  143. RewriteCond %{HTTP:Accept-encoding} gzip
  144. RewriteCond %{REQUEST_FILENAME}\.gz -s
  145. RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
  146.  
  147. # Serve correct content types, and prevent mod_deflate double gzip.
  148. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
  149. RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
  150.  
  151. <FilesMatch "(\.js\.gz|\.css\.gz)$">
  152. # Serve correct encoding type.
  153. Header set Content-Encoding gzip
  154. # Force proxies to cache gzipped & non-gzipped css/js files separately.
  155. Header append Vary Accept-Encoding
  156. </FilesMatch>
  157. </IfModule>
  158. </IfModule>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement