Skip to content

Commit b5640be

Browse files
committed
增加了一些.htaccess,限制目录访问。修复webapp下的目录访问问题。
1 parent da07eb5 commit b5640be

File tree

7 files changed

+17
-9
lines changed

7 files changed

+17
-9
lines changed

.htaccess

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
RewriteEngine On
33
# The following rule tells Apache that if the requested filename
44
# exists, simply serve it.
5-
RewriteCond %{REQUEST_FILENAME} -s [OR]
6-
RewriteCond %{REQUEST_FILENAME} -l [OR]
7-
RewriteCond %{REQUEST_FILENAME} -d
8-
RewriteRule ^.*$ - [NC,L]
5+
#RewriteCond %{REQUEST_FILENAME} -s [OR]
6+
#RewriteCond %{REQUEST_FILENAME} -l [OR]
7+
#RewriteCond %{REQUEST_FILENAME} -d
8+
#RewriteRule ^.*$ - [NC,L]
99
# The following rewrites all other queries to index.php. The
1010
# condition ensures that if you are using Apache aliases to do
1111
# mass virtual hosting, the base path will be prepended to
1212
# allow proper resolution of the index.php file; it will work
1313
# in non-aliased environments as well, providing a safe, one-size
1414
# fits all solution.
15-
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::$
16-
RewriteRule ^(.*)$ - [E=BASE:%1]
17-
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
15+
#RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::$
16+
#RewriteRule ^(.*)$ - [E=BASE:%1]
17+
#RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
18+
19+
RewriteRule (/?[^\/]*\/css\/)(.*\.(jpg|jpeg|png|gif|tif|js|css))$ WebApp$1$2

WebApp/default/css/style.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
margin: 0;
3+
}

config/.htaccess

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deny from all

core/.htaccess

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deny from all

core/bootstrap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function rander()
3333
$page = $callHook['page'];
3434
if(file_exists(ROOT.DS.'WebApp'.DS.$app.DS.$page)) {
3535
include(ROOT.DS.'WebApp'.DS.$app.DS.$page);
36-
include (ROOT.DS.'core'.DS.'Ajax2.php');//加入ajax请求
36+
include (ROOT.DS.'core'.DS.'Ajax.php');//加入ajax请求
3737
} else {
3838
//show file not find
3939
echo "<h1>No such file or dirrectory</h1>";

data/.htaccess

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deny from all

data/default.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"dir":"default\\css\\style.css","md5":"d41d8cd98f00b204e9800998ecf8427e"},{"dir":"default\\index.html","md5":"b489d63579201a7f058a52889d60b57d"},{"dir":"default\\info.html","md5":"3218754a0679d3ae3bc63e854844db80"},{"dir":"default\\js\\default.js","md5":"d41d8cd98f00b204e9800998ecf8427e"},{"dir":"default\\js\\jquery.js","md5":"e1288116312e4728f98923c79b034b67"}]
1+
[{"dir":"default\\css\\style.css","md5":"f44021238a3348e1a3fc433f2f533d41"},{"dir":"default\\index.html","md5":"b489d63579201a7f058a52889d60b57d"},{"dir":"default\\info.html","md5":"3218754a0679d3ae3bc63e854844db80"},{"dir":"default\\js\\default.js","md5":"d41d8cd98f00b204e9800998ecf8427e"},{"dir":"default\\js\\jquery.js","md5":"e1288116312e4728f98923c79b034b67"}]

0 commit comments

Comments
 (0)