Chamillo .httaccess to OLS

Chamillo comes with the following .htaccess files. Any insights on how to get this website working are appreciated. I am using CyberPanel Version 1.6.

  • ./vendor/ezyang/htmlpurifier/maintenance/.htaccess
  • ./vendor/studio-42/elfinder/php/.tmp/.htaccess
  • ./.htaccess
  • ./app/.htaccess
  • ./app/home/.htaccess
  • ./app/upload/.htaccess
  • ./main/inc/ajax/.htaccess
  • ./main/inc/lib/.htaccess

Orginal ./vendor/ezyang/htmlpurifier/maintenance/.htaccess
Deny from all `

Static Context

`context /vendor/ezyang/htmlpurifier/maintenance/ {
  location                $DOC_ROOT/vendor/ezyang/htmlpurifier/maintenance
  allowBrowse             0
  addDefaultCharset       off
}`
```


Orginal ./vendor/studio-42/elfinder/php/.tmp/.htaccess 
`order deny,allow                                                                                                                                                      
deny from all   `
```


Static Context
`context /vendor/studio-42/elfinder/php/.tmp/ {
  location                $DOC_ROOT/vendor/studio-42/elfinder/php/.tmp
  allowBrowse             0
  addDefaultCharset       off
}`
```


Orginal ./.htaccess
`# Check that your Apache virtualhost have this settings:

#
#  AllowOverride All
#  Order allow,deny
#  Allow from all
#

RewriteEngine on

# http://my.chamilo.net/certificates/?id=123 to http://my.chamilo.net/certificates/index.php?id=123
RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^certificates/$ certificates/index.php?id=%1 [L]

# Course redirection
RewriteRule ^courses/([^/]+)/?$ main/course_home/course_home.php?cDir=$1 [QSA,L]
RewriteRule ^courses/([^/]+)/index.php$ main/course_home/course_home.php?cDir=$1 [QSA,L]

# Rewrite everything in the scorm folder of a course to the download script
RewriteRule ^courses/([^/]+)/scorm/(.*)$ main/document/download_scorm.php?doc_url=/$2&cDir=$1 [QSA,L]

# Rewrite everything in the document folder of a course to the download script
# Except certificate resources, which might need to be accessible publicly to all
RewriteRule ^courses/([^/]+)/document/certificates/(.*)$ app/courses/$1/document/certificates/$2 [QSA,L]
RewriteRule ^courses/([^/]+)/document/(.*)$ main/document/download.php?doc_url=/$2&cDir=$1 [QSA,L]

# Course upload files
RewriteRule ^courses/([^/]+)/upload/([^/]+)/(.*)$ main/document/download_uploaded_files.php?code=$1&type=$2&file=$3 [QSA,L]

# Rewrite everything in the work folder
RewriteRule ^courses/([^/]+)/work/(.*)$ main/work/download.php?file=work/$2&cDir=$1 [QSA,L]

RewriteRule ^courses/([^/]+)/course-pic85x85.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_source [QSA,L]
RewriteRule ^courses/([^/]+)/course-pic.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_large_source [QSA,L]

# Redirect all courses/ to app/courses/
RewriteRule ^courses/([^/]+)/(.*)$ app/courses/$1/$2 [QSA,L]

# About session
RewriteRule ^session/(\\d{1,})/about/?$ main/session/about.php?session_id=$1 [L]

# Issued individual badge friendly URL
RewriteRule ^badge/(\\d{1,}) main/badge/issued.php?issue=$1 [L]

# Issued badges friendly URL
RewriteRule ^skill/(\\d{1,})/user/(\\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L]
# Support deprecated URL (avoid 404)
RewriteRule ^badge/(\\d{1,})/user/(\\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L]

# Support old URLs using the exercice (with a c) folder rather than exercise
RewriteRule ^main/exercice/(.*)$ main/exercise/$1 [QSA,L]
# Support old URLs using the newscorm folder rather than lp
RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L]

# service Information
RewriteRule ^service/(\\d{1,})$ plugin/buycourses/src/service_information.php?service_id=$1 [L]

# This rule is very generic and should always remain at the bottom of .htaccess
# http://my.chamilo.net/jdoe to http://my.chamilo.net/user.php?jdoe
RewriteRule ^([^/.]+)/?$ user.php?$1 [L]

# Deny access
RewriteRule ^(tests|.git) - [F,L,NC]

# Add caching of woff font files to avoid loading 2*15KB each time with Chamilo
# default OpenSans font
AddType application/font-woff .woff .woff2

  ExpiresActive On
  ExpiresByType application/font-woff "access plus 1 month"
`
```



Static Context
`context / {
  location                $DOC_ROOT
  allowBrowse             1
  enableExpires           1
  expiresByType           application/font-woff=A2629746
  addMIMEType             application/font-woff woff woff2

  rewrite  {
RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^certificates/$ certificates/index.php?id=%1 [L]
RewriteRule ^courses/([^/]+)/?$ main/course_home/course_home.php?cDir=$1 [QSA,L]
RewriteRule ^courses/([^/]+)/index.php$ main/course_home/course_home.php?cDir=$1 [QSA,L]
RewriteRule ^courses/([^/]+)/scorm/(.*)$ main/document/download_scorm.php?doc_url=/$2&cDir=$1 [QSA,L]
RewriteRule ^courses/([^/]+)/document/certificates/(.*)$ app/courses/$1/document/certificates/$2 [QSA,L]
RewriteRule ^courses/([^/]+)/document/(.*)$ main/document/download.php?doc_url=/$2&cDir=$1 [QSA,L]
RewriteRule ^courses/([^/]+)/upload/([^/]+)/(.*)$ main/document/download_uploaded_files.php?code=$1&type=$2&file=$3 [QSA,L]
RewriteRule ^courses/([^/]+)/work/(.*)$ main/work/download.php?file=work/$2&cDir=$1 [QSA,L]
RewriteRule ^courses/([^/]+)/course-pic85x85.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_source [QSA,L]
RewriteRule ^courses/([^/]+)/course-pic.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_large_source [QSA,L]
RewriteRule ^courses/([^/]+)/(.*)$ app/courses/$1/$2 [QSA,L]
RewriteRule ^session/(\\d{1,})/about/?$ main/session/about.php?session_id=$1 [L]
RewriteRule ^badge/(\\d{1,}) main/badge/issued.php?issue=$1 [L]
RewriteRule ^skill/(\\d{1,})/user/(\\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L]
RewriteRule ^badge/(\\d{1,})/user/(\\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L]
RewriteRule ^main/exercice/(.*)$ main/exercise/$1 [QSA,L]
RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L]
RewriteRule ^service/(\\d{1,})$ plugin/buycourses/src/service_information.php?service_id=$1 [L]
RewriteRule ^([^/.]+)/?$ user.php?$1 [L]
RewriteRule ^(tests|.git) - [F,L,NC]
  }
  addDefaultCharset       off

  phpIniOverride  {

  }
}`
```


Orginal ./app/.htaccess
Options -Indexes`

Static Context
`context /app/ {
  location                $DOC_ROOT/app
  allowBrowse             1
  autoIndex               0
  addDefaultCharset       off
}`
```


Orginal ./app/home/.htaccess
`                                                                                            
    deny from all                                                                                                                                                     
   `
```


Static Context
`context /app/home/ {
  location                $DOC_ROOT/app/home
  allowBrowse             1
  addDefaultCharset       off

  phpIniOverride  {
php_flag engine off
  }
}`
```


Orginal ./app/upload/.htaccess
`                                                                                            
    # Apache 2.2                                                                                                                                                      
    #deny from all                                                                                                                                                    
    # Apache 2.4                                                                                                                                                      
    Require all denied                                                                                                                                                
 `
```


Static Context
`context /app/upload/ {
  location                $DOC_ROOT/app/upload
  allowBrowse             1
  addDefaultCharset       off

  phpIniOverride  {
php_flag engine off
  }
}`
```


Orginal ./main/inc/ajax/.htaccess
Options -Indexes`

Static Context
`context /main/inc/ajax/ {
  location                $DOC_ROOT/main/inc/ajax
  allowBrowse             1
  autoIndex               0
  addDefaultCharset       off
}`
```


Orginal ./main/inc/lib/.htaccess
Options -Indexes `

Static Context
`context /main/inc/lib/ {
  location                $DOC_ROOT/main/inc/lib
  allowBrowse             1
  note                    Options -Indexes
  autoIndex               0
  addDefaultCharset       off
}`
```