add rewrite rules for Apache

This commit is contained in:
printempw 2016-02-14 09:29:21 +08:00
parent b43b19abe4
commit f2f6654107
2 changed files with 8 additions and 0 deletions

6
.htaccess Normal file
View File

@ -0,0 +1,6 @@
RewriteEngine on
RewriteRule ^([^/]*).json$ get.php?type=json&uname=$1 [L]
RewriteRule ^(skin|cape)/([^/-]*)(|-)(|alex|steve).png$ get.php?type=$1&model=$4&uname=$2 [L]
# 以下是可选内容
RewriteRule ^(usm|csl)/([^/]*).json$ get.php?type=json&uname=$2&api=$1 [L]
RewriteRule ^(usm|csl)/textures/(.*)$ textures/$2 [L]

View File

@ -44,6 +44,8 @@ rewrite ^/subdir/([^/]*).json$ /subdir/get.php?type=json&uname=$1 last;
注意 `^/``/get.php` 前都要加上你的子目录名。
如果你使用 Apache 作为 web 服务器,那么恭喜你,我已经帮你把重写规则写好在 `.htaccess` 里啦,开箱即用,无需任何配置~
现在你可以访问 `http://example.com/username.json` 来得到你的首选 API 的 JSON 用户数据。另外一个 API 的 JSON 数据可以通过访问 `http://example.com/(usm|csl)/username.json` 得到(需配置可选重写规则)。
上传完皮肤后,你就可以访问 `http://example.com/skin/username.png` 得到你的首选模型皮肤啦。 披风图片在这里:`http://example.com/cape/username.png` 。你还可以访问 `http://example.com/skin/username-(alex|steve).png` 来得到用户的 Alex/Steve 模型的皮肤文件(用户没上传则返回空)。