Install a new writeHtaccess() function in the install process that takes
/htaccess-dist and replaces {BASE_URL} for the appropiate value used by
RewriteBase to find Chamilo files.
This solves the problem of Chamilo installations that are not hosted on
a web server root. Namely, all the http://domain/chamilo-lms installs.
The method follows similar practice by WordPress where the .htaccess
file is generated by WordPress on demand when the user activates pretty
permalinks.
A follow–up commit enhances the safety of this process by making sure
the site URL is clean enough for RewriteBase.
			
			
				1.10.x
			
			
		
							parent
							
								
									96e9ed2133
								
							
						
					
					
						commit
						433657ce64
					
				@ -1,39 +0,0 @@ | 
				
			||||
<IfModule mod_rewrite.c> | 
				
			||||
    Options -MultiViews | 
				
			||||
    Options +FollowSymLinks | 
				
			||||
 | 
				
			||||
    RewriteEngine On | 
				
			||||
    RewriteBase / | 
				
			||||
 | 
				
			||||
    # Courses home | 
				
			||||
    RewriteCond %{QUERY_STRING} ^id_session=0 | 
				
			||||
    RewriteRule ^courses/(.*)/(.*)$ web/courses/$1? [R,L] | 
				
			||||
 | 
				
			||||
    RewriteCond %{QUERY_STRING} ^id_session=([0-9]*) | 
				
			||||
    RewriteRule ^courses/(.*)/(.*)$ web/courses/$1/%1/? [R,L] | 
				
			||||
 | 
				
			||||
    RewriteRule ^courses/(.*)/index.php$ web/courses/$1? [R,L] | 
				
			||||
    RewriteRule ^courses/(.*)/$ web/courses/$1? [R,L] | 
				
			||||
 | 
				
			||||
    # PHP Main files are redirected to the "web/main" zone | 
				
			||||
 | 
				
			||||
    RewriteRule ^main/(.*)\.php web/main/$1.php [R,L] | 
				
			||||
 | 
				
			||||
    # Courses documents | 
				
			||||
    # courses/MATHS/document/folder1/picture.jpg --> web/data/courses/MATHS/document/folder1/picture.jpg | 
				
			||||
    RewriteRule ^courses/(.*)/document/(.*)$ web/data/courses/$1/document/$2 [R,L] | 
				
			||||
 | 
				
			||||
    # SCORM documents | 
				
			||||
    # courses/MATHS/scorm/folder1/picture.jpg --> web/data/courses/MATHS/scorm/folder1/picture.jpg | 
				
			||||
    RewriteRule ^courses/(.*)/scorm/(.*)$ web/data/courses/$1/scorm/$2 [R,L] | 
				
			||||
 | 
				
			||||
    # Certificates | 
				
			||||
    # Redirection: certificates/index.php?id=123 -> web/certificates/123 | 
				
			||||
    RewriteCond %{QUERY_STRING} ^id=([0-9]*) | 
				
			||||
    RewriteRule ^certificates/(.*)$ web/certificates/%1? [R,L] | 
				
			||||
 | 
				
			||||
    # Portal news | 
				
			||||
    # news_list.php?id=5 --> web/news/5 | 
				
			||||
    RewriteCond %{QUERY_STRING} ^id=([0-9]*) | 
				
			||||
    RewriteRule ^news_list.php?$ web/news/%1? [R,L] | 
				
			||||
</IfModule> | 
				
			||||
					Loading…
					
					
				
		Reference in new issue