.htaccess 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #RewriteMap lc int:tolower
  2. #ErrorDocument 403 /error/403.php
  3. #ErrorDocument 404 /error/404.php
  4. #ErrorDocument 500 /error/500.php
  5. #AddHandler application/x-httpd-php .xml
  6. #AddType application/x-httpd-php .xml
  7. AddType application/x-httpd-php .xml
  8. AddHandler php5-cgi .xml
  9. # <FilesMatch "\.php$">
  10. # Order allow, deny
  11. # Deny from all
  12. # </FilesMatch>
  13. Options +FollowSymlinks
  14. RewriteEngine on
  15. CheckSpelling on
  16. # Force https
  17. RewriteCond %{HTTPS} !=on
  18. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
  19. #RewriteCond %{HTTP:Accept-Language} ^(en|de|fr)[-,;]? [NC,OR]
  20. #RewriteCond %{REQUEST_URI} !^(en|es|eu)/[.]+
  21. #RewriteRule ^$ /en/$1 [NC]
  22. #RewriteRule ^([a-zA-Z]{2})/(.*)$ $2?lang=$1 [L]
  23. #RewriteCond %{REQUEST_URI} !^(en|es|eu)/[.]+
  24. #RewriteCond %{HTTP:Accept-Language} ^en [NC]
  25. #RewriteRule ^$ /en/%{REQUEST_URI} [L,R=301]
  26. #RewriteCond %{HTTP:Accept-Language} ^es [NC]
  27. #RewriteRule ^$ /de/%{REQUEST_URI} [L,R=301]
  28. #RewriteCond %{HTTP:Accept-Language} ^eu [NC]
  29. #RewriteRule ^$ /eu/%{REQUEST_URI} [L,R=301]
  30. #RewriteRule ^([a-zA-Z]{2})/(.*)$ $2?lang=$1 [L]
  31. #RewriteRule ^([a-zA-Z]{2})/(.*)$ $2?lang=$1 [NC]
  32. #RewriteCond %{REQUEST_URI} ![\/]?(en|es|eu)/[.]* [NC]
  33. #RewriteCond %{QUERY_STRING} ![.]*lang=[.]*
  34. #RewriteRule ^ /en%{REQUEST_URI} [R,L]
  35. #RewriteCond %{HTTP:Accept-Language} ^en [NC]
  36. #RewriteRule ^ /en%{REQUEST_URI} [R,L]
  37. #RewriteRule ^ https://inigovalentin.com/en%{REQUEST_URI} [R,L]
  38. RewriteCond %{REQUEST_URI} ![\/]?(en|es|eu)/[.]* [NC]
  39. RewriteCond %{QUERY_STRING} ![.]*lang=[.]*
  40. RewriteCond %{HTTP:Accept-Language} ^en [NC]
  41. RewriteRule ^ /en%{REQUEST_URI} [R,L]
  42. #RewriteRule ^ https://inigovalentin.com/en%{REQUEST_URI} [R,L]
  43. #RewriteCond %{REQUEST_URI} [\/]?(en|es|eu)/[.]* [NC]
  44. #RewriteCond %{REQUEST_URI} /(en|es|eu)/[.]* [NC]
  45. #RewriteRule ^[\/]?([a-zA-Z]{2})[\/]?(.*)$ $2?lang=$1 [NC,L]
  46. RewriteCond %{REQUEST_URI} /(en|es|eu)/[.]* [NC]
  47. RewriteRule ^[\/]?([a-zA-Z]{2})[\/]?(.*)$ $2?lang=$1 [NC,L]
  48. #RewriteCond %{REQUEST_URI} !/(en|es|eu)/ [NC]
  49. #RewriteCond %{HTTP:Accept-Language} ^es [NC]
  50. #RewriteRule ^ https://inigovalentin.com/es%{REQUEST_URI} [R,NC]
  51. #[R,L]
  52. #RewriteCond %{REQUEST_URI} !/(en|es|eu)/ [NC]
  53. #RewriteCond %{HTTP:Accept-Language} ^eu [NC]
  54. #RewriteRule ^ https://inigovalentin.com/eu%{REQUEST_URI} [NC]
  55. #[R,L]
  56. #RewriteRule ^([a-zA-Z]{2})/(.*)$ $2?lang=$1 [NC]
  57. #[L]
  58. #RewriteCond %{REQUEST_URI} !/(it|en|admin)/ [NC]
  59. #RewriteRule ^ http://domain.net/en%{REQUEST_URI} [R,L]
  60. # Permalink rewrites
  61. #RewriteRule ^sitemap.xml$ /sitemap.php [NC]
  62. #RewriteRule ^imgmap.xml$ /sitemap-image.php [NC]
  63. #RewriteRule ^rss.xml$ /rss.php [NC]
  64. #RewriteRule ^blog/([A-Z\-a-z0-9]{3,}+)[\/]?$ /blog/post.php?permalink=$1 [NC]
  65. #RewriteRule ^project/([A-Z\-a-z0-9]{3,}+)[\/]?$ /project/project.php?permalink=$1 [NC]
  66. #RewriteRule ^help[\/]?$ /help/index.php [NC]
  67. #RewriteRule ^(yo|me|ni)[\/]?$ /me/index.php [NC]
  68. #RewriteRule !^(en|de|fr)/ /en%{REQUEST_URI} [R=301,L]
  69. #RewriteCond %{HTTP:Accept-Language} ^(en|de|fr)[-,;]? [NC,OR]
  70. #RewriteCond en ^(en)$
  71. #RewriteRule ^$ /%1/ [R=301,L]
  72. #RewriteRule !^(en|de|fr)/ /en%{REQUEST_URI} [R=301,L]
  73. # BEGIN Cache-Control Headers
  74. <IfModule mod_expires.c>
  75. ExpiresActive on
  76. # ExpiresDefault "access plus 1 month"
  77. ExpiresByType application/javascript "access plus 6 days"
  78. ExpiresByType image/x-ico "access plus 12 days"
  79. ExpiresByType image/jpg "access plus 12 days"
  80. ExpiresByType image/jpeg "access plus 12 days"
  81. ExpiresByType image/gif "access plus 12 days"
  82. ExpiresByType image/png "access plus 12 days"
  83. ExpiresByType video/mkv "access plus 12 days"
  84. ExpiresByType text/css "access plus 6 days"
  85. ExpiresByType text/plain "access plus 6 days"
  86. </IfModule>
  87. # BEGIN Cache-Control Headers
  88. <ifModule mod_headers.c>
  89. <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
  90. Header set Cache-Control "max-age=864000, public, must-revalidate"
  91. </filesMatch>
  92. <filesMatch "\.(css)$">
  93. Header set Cache-Control "max-age=864000, public, must-revalidate"
  94. </filesMatch>
  95. <filesMatch "\.(js)$">
  96. Header set Cache-Control "max-age=864000, private, must-revalidate"
  97. </filesMatch>
  98. <filesMatch "\.(x?html?|php)$">
  99. Header set Cache-Control "max-age=86400, private, must-revalidate"
  100. </filesMatch>
  101. </ifModule>
  102. # END Cache-Control Headers
  103. <ifModule mod_deflate.c>
  104. AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
  105. AddOutputFilterByType DEFLATE image/x-icon
  106. AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
  107. AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
  108. AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
  109. AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
  110. AddOutputFilterByType DEFLATE font/truetype font/opentype
  111. </ifModule>
  112. # Enable memory caching
  113. #CacheEnable mem /
  114. # Limit the size of the cache to 1 Megabyte
  115. #MCacheSize 1024
  116. #CacheFile footer.php header.php img/*/*/*.jpg