diff --git a/.htaccess b/.htaccess index 79f6c06..19337f2 100755 --- a/.htaccess +++ b/.htaccess @@ -6,33 +6,29 @@ ## @version 1.2.2 ## ## + +RewriteEngine On +RewriteCond %{HTTP_HOST} (.*?).([a-z0-9]){1,64}.(localhost|snails.email)$ +RewriteRule ^$ ./index.php?action=jump&subdomain=1 [L,NC,QSA] + RewriteEngine On -RewriteCond %{HTTP_HOST} ([a-z0-9]){1,64}.localhost$ -RewriteCond %{HTTP_HOST} ([a-z0-9]){1,64}.snails.email$ -RewriteCond %{REQUEST_URI} ^assets(.*?)$ -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{HTTP_HOST} ([a-z0-9]){1,64}.(localhost|snails.email)$ +RewriteCond %{REQUEST_URI} ^([a-z0-9]{2})/(.*?)$ +RewriteRule ^([a-z0-9]{2})/url.api$ ./index.php?action=url [L,NC,QSA] +RewriteRule ^([a-z0-9]{2})/(.*?)$ ./index.php?action=jump&item=$2&version=$1 [L,NC,QSA] + +RewriteEngine On +RewriteCond %{HTTP_HOST} ([a-z0-9]){1,64}.(localhost|snails.email)$ +RewriteCond %{REQUEST_URI} ^assets/(.*?)$ RewriteRule ^/(media|css|jquery|images)/(.*?)/(.*?)/(.*?).(.*?)$ ./assets/$1/$2/$3/$4.$5 [L,NC,QSA] RewriteRule ^/(media|css|jquery|images)/(.*?)/(.*?).(.*?)$ ./assets/$1/$2/$3.$4 [L,NC,QSA] RewriteRule ^/(media|css|jquery|images)/(.*?).(.*?)$ ./assets/$1/$2.$3 [L,NC,QSA] RewriteEngine On -RewriteCond %{HTTP_HOST} ([a-z0-9]){1,64}.localhost$ -RewriteCond %{HTTP_HOST} ([a-z0-9]){1,64}.snails.email$ -RewriteCond %{REQUEST_URI} !^assets(.*?)$ -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{HTTP_HOST} ([a-z0-9]){1,64}.(localhost|snails.email)$ +RewriteCond %{REQUEST_URI} !^assets/(.*?)$ RewriteRule ^favicon.ico$ ./assets/images/favicon.ico [L,NC,QSA] RewriteRule ^icon.png$ ./assets/images/icon.png [L,NC,QSA] RewriteRule ^url.api$ ./index.php?action=url [L,NC,QSA] -RewriteRule ^v2/url.api$ ./index.php?action=url [L,NC,QSA] -RewriteRule ^/(.*?){2,200}$ ./index.php?action=jump&item=$1 [L,NC,QSA] -RewriteEngine On -RewriteCond %{HTTP_HOST} ^(.*?){2,200}.([a-z0-9]){1,64}.localhost$ -RewriteCond %{HTTP_HOST} ^(.*?){2,200}.([a-z0-9]){1,64}.snails.email$ -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteCond %{REQUEST_URI} ^/ -RewriteRule .* ./index.php?action=jump&subdomain=1 [L,NC,QSA] diff --git a/README.md b/README.md index 6387a4c..dbbb3db 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Jump URL Shortened API ~ http://jump.snails.email +## Chronolabs Cooperative presents -## Author: Simon Antony Roberts (c) 2019 +# Jump URL Shortened API -## Contact: simon@snails.email +## Author: Simon Antony Roberts (c) 2019 -### Version: 1.2.2 +### Version: 2.1.9 ### Demo: http://jump.snails.email diff --git a/functions.php b/functions.php index 27dde54..800c1f8 100755 --- a/functions.php +++ b/functions.php @@ -621,7 +621,7 @@ function jumpShortenURL($url = '') if ($values['last'] + $values['inactive'] < microtime(true)) unset($jumps[$finger]); } - $result = $jumps[$hash = md5($url.$referee.microtime(true))] = array("created" => microtime(true), "last" => microtime(true), 'inactive' => (API_DROP_DAYS_INACTIVE * (3600 * 24)), "short" => API_PROTOCOL.API_HOSTNAME.'/'.$referee, "domain" => API_PROTOCOL.$referee.'.'.API_HOSTNAME, 'url' => $url, 'referee' => $referee); + $result = $jumps[$hash = md5($url.$referee.microtime(true))] = array("created" => microtime(true), "last" => microtime(true), 'inactive' => (API_DROP_DAYS_INACTIVE * (3600 * 24)), "short" => API_PROTOCOL.API_HOSTNAME.'/v2/'.$referee, "domain" => API_PROTOCOL.$referee.'.'.API_HOSTNAME, 'url' => $url, 'referee' => $referee); writeRawFile($file, json_encode($jumps)); return $result; }