diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..5f20b32 --- /dev/null +++ b/.htaccess @@ -0,0 +1,14 @@ +Options -Indexes +order deny,allow + + +deny from all + + + +deny from all + + +RewriteEngine On +RewriteCond $1 !^(api|asset) +RewriteRule ^(\d+|\w+)$ index.php?id=$1 \ No newline at end of file diff --git a/LICENSE b/LICENSE index 17699cf..f292d5e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 任宝硕 +Copyright (c) 2017 Caringor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 22f960c..9bfe0a1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,19 @@ -# Shortlink -短链接生成网站源码 +# ShortLink + +代码基于 [CRZ.im](https://github.com/Caringor/CRZ.im) 开发,感谢原作者的辛勤劳动。 + +--- + +> 一个支持域名缩短网站的源代码 + +## 概述 + +这是一个网址缩短服务的网站的源代码。 + +## 安装 + +本项目基于 `PHP` 、 `SQLite` 进行开发,您只需要修改 `config.php` 的相关配置并把 inc 目录权限设置为可读写即可。对于 `Nginx` 用户,则还需把 `nginx.txt` 里面的内容添加到 `Nginx` 的配置文件里。 + +## 本项目相比原项目有了什么变化? + +本项目增加了 diff --git a/config.php b/config.php new file mode 100644 index 0000000..365d0bf --- /dev/null +++ b/config.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..56d96ec --- /dev/null +++ b/index.php @@ -0,0 +1,68 @@ +get_url($_GET['id']); + // 重定向至目标网址 + if($url) { + header('Location: ' . $url); + exit; + } + } +?> + + + + + + + + <?php echo get_title() . ' - ' . get_description(); ?> + + + + + + + +
+ +
+

+

+
+

+ + + +
+ + + + + + + + \ No newline at end of file diff --git a/nginx.txt b/nginx.txt new file mode 100644 index 0000000..2d72090 --- /dev/null +++ b/nginx.txt @@ -0,0 +1,11 @@ +# REWRITE START +location / { + try_files $uri $uri/ =404; +} +location ~ /inc/ { + return 404; +} +location ~* ^/(?![asset|api]) { + rewrite (\d+|\w+)$ /index.php?id=$1; +} +# REWRITE END