diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..52ae32d4 --- /dev/null +++ b/.htaccess @@ -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] diff --git a/README.md b/README.md index ea85ac8d..efd28a0a 100644 --- a/README.md +++ b/README.md @@ -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 模型的皮肤文件(用户没上传则返回空)。