Advertisement
Guest User

htaccess

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