|
本帖最后由 追影 于 2014-10-17 11:43 编辑
apache
这是官网的url重写
[IfModule mod_rewrite.c]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
[/IfModule]
RewriteRule ^Web/Tpl/.*/.*\.(html|xml)$ / [F]
RewriteRule ^Admin/Tpl/.*/.*\.(html|xml)$ / [F]
nginx
采用官网的URL重写
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
模板保护(我自己写的,测试有效,如有错的地方请大神指出)
location ~ Web/Tpl/.*/.*\.(html|xml)$ {
deny all;
}
location ~ Admin/Tpl/.*/.*\.(html|xml)$ {
deny all;
}
来源:http://www.ck0.cn/tutorial/damicms_ngx-apa-rewrite_14.html
|
|