diff --git a/short-url/src/index.ts b/short-url/src/index.ts
index 39242e1afc9ed98681f7132670212175f52c71ab..056da4fa8e905f6bbfe071b07ec7bd95dfecb510 100644
--- a/short-url/src/index.ts
+++ b/short-url/src/index.ts
@@ -37,9 +37,15 @@ export default {
 		console.log(`search: ${search}`);
 
 		if (search[0] === '?') {
-				let key = generateRandomString(6);
-				while (await env.KV_STORAGE.get(key) !== null)
+				let key;
+				if (pathname.length >= 2) {
+					key = pathname.substr(1);
+				}
+				else {
+					key = generateRandomString(6);
+					while (await env.KV_STORAGE.get(key) !== null)
 						key = generateRandomString(6);
+				}
 
 				await env.KV_STORAGE.put(key, search.substr(1));
 				return new Response(`<a href=${protocol}//${host}/${key}>${protocol}//${host}/${key}</a>`, { headers: { 'Content-Type': 'text/html'}});