Advertisement
Guest User

Untitled

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