-
Notifications
You must be signed in to change notification settings - Fork 5
/
htaccess
151 lines (128 loc) · 6.16 KB
/
htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
##
#
# This file is part of Moodle - http://moodle.org/
#
# Moodle is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Moodle is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Moodle. If not, see <http://www.gnu.org/licenses/>.
#
# SEF URLs support
#
# @package local
# @subpackage sef
# @version 2012100900.00
# @author Matteo Scaramuccia <[email protected]>
# @copyright Copyright (C) 2012 Matteo Scaramuccia
# @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
#
##
# Always follow the symlinks
Options +FollowSymlinks
# Enable mod_rewrite
RewriteEngine On
# The path to the Moodle instance
RewriteBase /moodle/
############################# CALENDAR ##############################
# calendar/<id, i.e. Moodle magic number>
# calendar/<id, i.e. Moodle magic number><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_URI} calendar/([\d]+)
RewriteRule calendar/([\d]+) calendar/view.php?course=$1 [L,QSA]
#
######################################################################
############################## COURSE ##############################
# course/{name,idnumber,id}/<value of the provided key>
# course/{name,idnumber,id}/<value of the provided key><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule course/(name|idnumber|id)/([^/$]+) course/view.php?$1=$2 [L,QSA]
# course/<id, i.e. Moodle magic number>
# course/<id, i.e. Moodle magic number><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_URI} course/([\d]+)
RewriteRule course/([\d]+) course/view.php?id=$1 [L,QSA]
# course/<value, i.e. shortname>
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} course/([^/$]+) [NC]
RewriteRule course/([^/$]+) course/view.php?name=$1 [L,QSA]
#
######################################################################
############################## FORUM ###############################
# forums/<course id, i.e. Moodle magic number>
# forums/<course id, i.e. Moodle magic number><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule forums/([\d]+) mod/forum/index.php?id=$1 [L,QSA]
# forum/{id,f}/<value of the provided key>
# forum/{id,f}/<value of the provided key><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule forum/(id|f)/([^/$]+) mod/forum/view.php?$1=$2 [L,QSA]
# discuss/<id, i.e. Moodle magic number>
# discuss/<id, i.e. Moodle magic number><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule discuss/([\d]+) mod/forum/discuss.php?d=$1 [L,QSA]
#
######################################################################
############################# RESOURCE #############################
# resource/{id,r}/<value of the provided key>
# resource/{id,r}/<value of the provided key><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule resource/(id|r)/([^/$]+) mod/resource/view.php?$1=$2 [L,QSA]
#
######################################################################
################################ TAG ###############################
# tag/<id, i.e. Moodle magic number>
# tag/<id, i.e. Moodle magic number><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule tag/([\d]+) tag/index.php?id=$2 [L,QSA]
#
######################################################################
############################### USER ###############################
# users/<course id, i.e. Moodle magic number>
# users/<course id, i.e. Moodle magic number><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_URI} users/([\d]+)
RewriteRule users/([\d]+) user/index.php?id=$1 [L,QSA]
# user/<id, i.e. Moodle magic number>
# user/<id, i.e. Moodle magic number><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_URI} user/([\d]+)
RewriteRule user/([\d]+) user/view.php?id=$1 [L,QSA]
#
######################################################################
######################### GENERIC ACTIVITY #########################
#
# Activity name:
# assignment, assign, book, chat, choice, data, feedback, folder,
# forum, glossary, imscp, label, lesson, lti, page, quiz,
# resource, scorm, survey, url, wiki, workshop,
# <activity name>/<id, i.e. Moodle magic number>
# <activity name>/<id, i.e. Moodle magic number><a char used to introduce the SEF statement, e.g. "/" or "-"><whatever you want for a SEF URL>
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ([^/]+)/([\d]+)
RewriteRule (.+)/([\d]+) mod/$1/view.php?id=$2 [L,QSA]
#
######################################################################