.htaccess 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Check that your Apache virtualhost have this settings:
  2. #<Directory "/var/www/chamilo-classic">
  3. # AllowOverride All
  4. # Order allow,deny
  5. # Allow from all
  6. #</Directory>
  7. RewriteEngine on
  8. # Prevent execution of PHP from directories used for different types of uploads
  9. RedirectMatch 403 ^/app/(cache|courses|home|logs|upload|Resources/public/css)/.*\.ph(p[3457]?|t|tml|ar)$
  10. RedirectMatch 403 ^/main/default_course_document/images/.*\.ph(p[3457]?|t|tml|ar)$
  11. RedirectMatch 403 ^/main/lang/.*\.ph(p[3457]?|t|tml|ar)$
  12. RedirectMatch 403 ^/web/css/.*\.ph(p[3457]?|t|tml|ar)$
  13. # http://my.chamilo.net/certificates/?id=123 to http://my.chamilo.net/certificates/index.php?id=123
  14. RewriteCond %{QUERY_STRING} ^id=(.*)$
  15. RewriteRule ^certificates/$ certificates/index.php?id=%1 [L]
  16. # Course redirection
  17. RewriteRule ^courses/([^/]+)/?$ main/course_home/course_home.php?cDir=$1 [QSA,L]
  18. RewriteRule ^courses/([^/]+)/index.php$ main/course_home/course_home.php?cDir=$1 [QSA,L]
  19. # Rewrite everything in the scorm folder of a course to the download script
  20. # except JS and CSS files, which can be served directly
  21. RewriteRule ^courses/([^/]+)/scorm/(.*([\.js|\.css]))$ app/courses/$1/scorm/$2 [QSA,L]
  22. RewriteRule ^courses/([^/]+)/scorm/(.*)$ main/document/download_scorm.php?doc_url=/$2&cDir=$1 [QSA,L]
  23. # Rewrite everything in the document folder of a course to the download script
  24. # Except certificate resources, which might need to be accessible publicly to all
  25. RewriteRule ^courses/([^/]+)/document/certificates/(.*)$ app/courses/$1/document/certificates/$2 [QSA,L]
  26. #RewriteRule ^courses/([^/]+)/document/(.*)$ main/document/download.php?doc_url=/$2&cDir=$1 [QSA,L]
  27. RewriteRule ^courses/([^/]+)/document/(.*)$ public/courses.php?courseCode=$1&url=$2 [L,NC]
  28. # Optimize load of custom per-course icons in courses (avoid download_uploaded_files.php)
  29. RewriteRule ^courses/([^/]+)/upload/course_home_icons/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$ app/courses/$1/upload/course_home_icons/$2 [QSA,L]
  30. # Course upload files
  31. RewriteRule ^courses/([^/]+)/upload/([^/]+)/(.*)$ main/document/download_uploaded_files.php?code=$1&type=$2&file=$3 [QSA,L]
  32. # Rewrite everything in the work folder
  33. RewriteRule ^courses/([^/]+)/work/(.*)$ main/work/download.php?file=work/$2&cDir=$1 [QSA,L]
  34. #RewriteRule ^courses/([^/]+)/course-pic85x85.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_source [QSA,L]
  35. #RewriteRule ^courses/([^/]+)/course-pic.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_large_source [QSA,L]
  36. RewriteRule ^courses/([^/]+)/course-pic85x85.png$ var/courses/$1/course-pic85x85.png [QSA,L]
  37. RewriteRule ^courses/([^/]+)/course-pic.png$ var/courses/$1/course-pic.png [QSA,L]
  38. # Redirect all courses/ to app/courses/
  39. RewriteRule ^courses/([^/]+)/(.*)$ app/courses/$1/$2 [QSA,L]
  40. # About session
  41. RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L]
  42. # About course
  43. RewriteRule ^course/(\d{1,})/about/?$ main/course_info/about.php?course_id=$1 [L]
  44. # Issued individual badge friendly URL
  45. RewriteRule ^badge/(\d{1,}) main/badge/issued.php?issue=$1 [L]
  46. # Issued badges friendly URL
  47. RewriteRule ^skill/(\d{1,})/user/(\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L]
  48. # Support deprecated URL (avoid 404)
  49. RewriteRule ^badge/(\d{1,})/user/(\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L]
  50. # Support old URLs using the exercice (with a c) folder rather than exercise
  51. RewriteRule ^main/exercice/(.*)$ main/exercise/$1 [QSA,L]
  52. # Support old URLs using the newscorm folder rather than lp
  53. RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L]
  54. # service Information
  55. RewriteRule ^service/(\d{1,})$ plugin/buycourses/src/service_information.php?service_id=$1 [L]
  56. RewriteRule ^lti/os$ public/lti/os [L]
  57. # Deny access
  58. RewriteRule ^(tests|.git|.env|.env.dist|.env.local|config) - [F,L,NC]
  59. # Add caching of woff font files to avoid loading 2*15KB each time with Chamilo
  60. # default OpenSans font
  61. AddType application/font-woff .woff .woff2
  62. <IfModule mod_expires.c>
  63. ExpiresActive On
  64. ExpiresByType application/font-woff "access plus 1 month"
  65. </IfModule>