.htaccess 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. RewriteRule ^courses/([^/]+)/scorm/(.*)$ main/document/download_scorm.php?doc_url=/$2&cDir=$1 [QSA,L]
  21. # Rewrite everything in the document folder of a course to the download script
  22. # Except certificate resources, which might need to be accessible publicly to all
  23. RewriteRule ^courses/([^/]+)/document/certificates/(.*)$ app/courses/$1/document/certificates/$2 [QSA,L]
  24. RewriteRule ^courses/([^/]+)/document/(.*)$ main/document/download.php?doc_url=/$2&cDir=$1 [QSA,L]
  25. # Course upload files
  26. RewriteRule ^courses/([^/]+)/upload/([^/]+)/(.*)$ main/document/download_uploaded_files.php?code=$1&type=$2&file=$3 [QSA,L]
  27. # Rewrite everything in the work folder
  28. RewriteRule ^courses/([^/]+)/work/(.*)$ main/work/download.php?file=work/$2&cDir=$1 [QSA,L]
  29. RewriteRule ^courses/([^/]+)/course-pic85x85.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_source [QSA,L]
  30. RewriteRule ^courses/([^/]+)/course-pic.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_large_source [QSA,L]
  31. # Redirect all courses/ to app/courses/
  32. RewriteRule ^courses/([^/]+)/(.*)$ app/courses/$1/$2 [QSA,L]
  33. # About session
  34. RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L]
  35. # About course
  36. RewriteRule ^course/(\d{1,})/about/?$ main/course_info/about.php?course_id=$1 [L]
  37. # Issued individual badge friendly URL
  38. RewriteRule ^badge/(\d{1,}) main/badge/issued.php?issue=$1 [L]
  39. # Issued badges friendly URL
  40. RewriteRule ^skill/(\d{1,})/user/(\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L]
  41. # Support deprecated URL (avoid 404)
  42. RewriteRule ^badge/(\d{1,})/user/(\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L]
  43. # Support old URLs using the exercice (with a c) folder rather than exercise
  44. RewriteRule ^main/exercice/(.*)$ main/exercise/$1 [QSA,L]
  45. # Support old URLs using the newscorm folder rather than lp
  46. RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L]
  47. # service Information
  48. RewriteRule ^service/(\d{1,})$ plugin/buycourses/src/service_information.php?service_id=$1 [L]
  49. # This rule is very generic and should always remain at the bottom of .htaccess
  50. # http://my.chamilo.net/jdoe to http://my.chamilo.net/user.php?jdoe
  51. RewriteRule ^([^/.]+)/?$ user.php?$1 [L]
  52. # Deny access
  53. RewriteRule ^(tests|.git) - [F,L,NC]
  54. # Add caching of woff font files to avoid loading 2*15KB each time with Chamilo
  55. # default OpenSans font
  56. AddType application/font-woff .woff .woff2
  57. <IfModule mod_expires.c>
  58. ExpiresActive On
  59. ExpiresByType application/font-woff "access plus 1 month"
  60. </IfModule>