diff --git a/htdocs/.htaccess b/htdocs/.htaccess new file mode 100644 index 0000000..734403d --- /dev/null +++ b/htdocs/.htaccess @@ -0,0 +1,12 @@ +# 不允許列出目錄 +Options -Indexes + +# --------------------------------------------------------- + +# 網址改寫 +RewriteEngine On + +## For API +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule (API|api)/v2/(.*)$ API/v2/index.php/$1 [L] diff --git a/htdocs/API/v2/here b/htdocs/API/v2/here deleted file mode 100644 index e69de29..0000000 diff --git a/htdocs/API/v2/index.php b/htdocs/API/v2/index.php new file mode 100644 index 0000000..0df290d --- /dev/null +++ b/htdocs/API/v2/index.php @@ -0,0 +1,15 @@ +get('/', function () { + echo "Test"; +}); + +$app->get('/hello/:name', function ($name) { + echo "Hello, $name"; +}); + +$app->run();