.htaccess 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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/(?!courses/proxy)(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, CSS and some image files, which can be served directly
  21. RewriteRule ^courses/([^/]+)/scorm/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$ 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. # Optimize load of custom per-course icons in courses (avoid download_uploaded_files.php)
  28. RewriteRule ^courses/([^/]+)/upload/course_home_icons/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$ app/courses/$1/upload/course_home_icons/$2 [QSA,L]
  29. # Course upload files
  30. RewriteRule ^courses/([^/]+)/upload/([^/]+)/(.*)$ main/document/download_uploaded_files.php?code=$1&type=$2&file=$3 [QSA,L]
  31. # Rewrite everything in the work folder
  32. RewriteRule ^courses/([^/]+)/work/(.*)$ main/work/download.php?file=work/$2&cDir=$1 [QSA,L]
  33. RewriteRule ^courses/([^/]+)/course-pic85x85.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_source [QSA,L]
  34. RewriteRule ^courses/([^/]+)/course-pic.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_large_source [QSA,L]
  35. # Redirect all courses/ to app/courses/
  36. RewriteRule ^courses/([^/]+)/(.*)$ app/courses/$1/$2 [QSA,L]
  37. # About session
  38. RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L]
  39. # About course
  40. RewriteRule ^course/(\d{1,})/about/?$ main/course_info/about.php?course_id=$1 [L]
  41. # Issued individual badge friendly URL
  42. RewriteRule ^badge/(\d{1,})/?$ main/badge/issued.php?issue=$1 [L]
  43. # Issued badges friendly URL
  44. RewriteRule ^skill/(\d{1,})/user/(\d{1,})/?$ main/badge/issued_all.php?skill=$1&user=$2 [L]
  45. # Support deprecated URL (avoid 404)
  46. RewriteRule ^badge/(\d{1,})/user/(\d{1,})/?$ main/badge/issued_all.php?skill=$1&user=$2 [L]
  47. # Support old URLs using the exercice (with a c) folder rather than exercise
  48. RewriteRule ^main/exercice/(.*)$ main/exercise/$1 [QSA,L]
  49. # Support old URLs using the newscorm folder rather than lp
  50. RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L]
  51. # service Information
  52. RewriteRule ^service/(\d{1,})$ plugin/buycourses/src/service_information.php?service_id=$1 [L]
  53. # LTI outcome service
  54. RewriteRule ^lti/os$ plugin/ims_lti/outcome_service.php [L]
  55. # This rule is very generic and should always remain at the bottom of .htaccess
  56. # http://my.chamilo.net/jdoe to http://my.chamilo.net/user.php?jdoe
  57. RewriteRule ^([^/.]+)/?$ user.php?$1 [L]
  58. # Deny direct access to user my files
  59. RewriteRule ^app/upload/users/([^/]+)/([^/]+)/my_files/(.*)$ main/social/download_my_files.php?user_id=$2&file=$3 [QSA,L]
  60. # Deny access
  61. RewriteRule ^(tests|.git) - [F,L,NC]
  62. # Add caching of woff font files to avoid loading 2*15KB each time with Chamilo
  63. # default OpenSans font
  64. AddType application/font-woff .woff .woff2
  65. <IfModule mod_expires.c>
  66. ExpiresActive On
  67. ExpiresByType application/font-woff "access plus 1 month"
  68. </IfModule>