@@ -2,54 +2,62 @@ Options +FollowSymlinks
2
2
3
3
RewriteEngine On
4
4
5
- # Scalar pages have default views that are called when a URI has no file extension
6
- # Turn off the MultiView option (if it's on) so it doesn't conflict
5
+ # Scalar pages have default views that are called when a URI has no
6
+ # file extension Turn off the MultiView option (if it's on) so it
7
+ # doesn't conflict
7
8
Options -MultiViews
8
9
9
10
# To route all requests to a maintenance page, uncomment these lines
10
- #RewriteCond %{REQUEST_FILENAME} !maintenance.html [NC]
11
- #RewriteRule (.*) maintenance.html [L]
12
-
13
- # To route the home page (book index) to some place else, uncomment these lines
11
+ #RewriteCond $1 !^maintenance.html$ [NC]
12
+ #RewriteRule (.*) maintenance.html [R=503,L]
13
+
14
+ # To protect all hidden files and directories
15
+ # (including, most importantly, .git)
16
+ RewriteRule (^\.)|(/\.) - [R=404 ,L]
17
+
18
+ # Block any files in the root directory other
19
+ # than codeigniter.php and maintenance.html
20
+ RewriteCond ${REQUEST_FILENAME} -f
21
+ RewriteCond $1 !maintenance.html$
22
+ RewriteCond $1 !codeigniter.php$
23
+ RewriteRule ^([^/]+)$ - [R=404 ,L]
24
+
25
+ # To route the home page (book index) to some place else, uncomment
26
+ # these lines
14
27
#RewriteCond %{REQUEST_FILENAME} ^/Library/WebServer/scalar\.usc\.edu/anvc/index\.php$
15
28
#RewriteRule (.*) /Library/WebServer/scalar.usc.edu/anvc_site/ [L]
16
29
#RewriteCond %{REQUEST_FILENAME} ^/Library/WebServer/scalar\.usc\.edu/anvc/$
17
30
#RewriteRule (.*) /Library/WebServer/scalar.usc.edu/anvc_site/ [L]
18
31
19
- # If your server is running SSL, uncomment these lines to force all requests through https
32
+ # If your server is running SSL, uncomment these lines to force all
33
+ # requests through https
20
34
#RewriteCond %{SERVER_PORT} 80
21
35
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
22
36
23
- # To protect against malicious file uploads (e.g., PHP files) uncomment these lines
24
- # and make sure to set "/scalar" in the second line to the path to your Scalar install
37
+ # To protect against malicious file uploads (e.g., PHP files)
38
+ # uncomment these lines
25
39
#RewriteCond %{REQUEST_FILENAME} -f
26
- #RewriteCond %{REQUEST_URI} !^/scalar/system(.*) [NC]
27
- #RewriteCond %{REQUEST_FILENAME} !codeigniter.php [NC]
28
40
#RewriteCond %{REQUEST_FILENAME} (\.php)$ [NC]
29
- #RewriteRule ^(.*)$ - [R=404,L]
41
+ #RewriteCond $1 !^system/(.*) [NC]
42
+ #RewriteCond $1 !^codeigniter.php(/.*)?$ [NC]
43
+ #RewriteRule (.*) - [R=404,L]
30
44
31
- # To route to an alternative file uploads path (e.g. "uploads" directory) uncomment these lines
32
- # or change to the desired location. This should match the localDir specified in local_settings.php
33
- #RewriteCond "%{DOCUMENT_ROOT}/uploads/%{REQUEST_URI}" -f
34
- #RewriteRule "^(.+)" "%{DOCUMENT_ROOT}/uploads/$1" [L]
45
+ # To route to an alternative file uploads path (e.g. "uploads"
46
+ # directory) uncomment these lines and change to the desired
47
+ # location. This should match the localDir specified in
48
+ # local_settings.php
49
+ #RewriteCond "%{CONTEXT_DOCUMENT_ROOT}/uploads/$1" -f
50
+ #RewriteRule (.+) "%{CONTEXT_DOCUMENT_ROOT}/uploads/$1" [L]
35
51
36
52
# Route to codeigniter if file or directory doesn't exist
37
- RewriteCond %{REQUEST_FILENAME} ! codeigniter.php [NC]
53
+ RewriteCond $1 !^ codeigniter.php(/.*)?$ [NC]
38
54
RewriteCond %{REQUEST_FILENAME} !-d
39
55
RewriteCond %{REQUEST_FILENAME} !-f
40
56
RewriteRule (.*) codeigniter.php/$1 [L]
41
57
RewriteRule ^$ codeigniter.php [L]
42
58
43
- # If a directory, don't send to codeigniter if it's the root folder
44
- # the server in turn will add the trailing slash and things are back to normal
45
- # This is to overcome what appears to be an old server setting on Vectors
46
- # and/or not being able to change DirectorySlash
47
- RewriteCond %{REQUEST_FILENAME} !codeigniter.php [NC]
48
- RewriteCond %{REQUEST_FILENAME} -d
49
- RewriteRule ^/(.*)$ - [L]
50
-
51
59
# Pass through directory
52
- RewriteCond %{REQUEST_FILENAME} ! codeigniter.php [NC]
60
+ RewriteCond $1 !^ codeigniter.php(/.*)?$ [NC]
53
61
RewriteCond %{REQUEST_FILENAME} -d
54
62
RewriteRule (.*) codeigniter.php/$1 [L]
55
63
0 commit comments