summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-02-09 14:25:06 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-02-09 14:25:06 -0800
commite3b999dc0520df1cc7ed0a4f92080368e9728cb9 (patch)
treeeba7cffe6db0e9e1c730115e580f24cbd13c7664
parente147e44088e8bc76fac2a3b92b32b76f9867280d (diff)
downloadpathery-e3b999dc0520df1cc7ed0a4f92080368e9728cb9.tar.xz
Map URL rewrite .com/map/ID - Note this has domain name in it...
-rw-r--r--.htaccess22
-rw-r--r--ajax/maps.ajax.php20
-rw-r--r--images/.htaccess5
-rw-r--r--index.php9
4 files changed, 44 insertions, 12 deletions
diff --git a/.htaccess b/.htaccess
index 3bf8b20..30b2ace 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,24 +1,26 @@
AddType x-mapp-php5 .php
-
-ErrorDocument 400 http://www.mazetd.4xg.net/error.php?error=400
-ErrorDocument 401 http://www.mazetd.4xg.net/error.php?error=401
-ErrorDocument 403 http://www.mazetd.4xg.net/error.php?error=403
-ErrorDocument 404 http://www.mazetd.4xg.net/error.php?error=404
-ErrorDocument 500 http://www.mazetd.4xg.net/error.php?error=500
-
+ErrorDocument 400 http://www.mazetd.4xg.net/errors.php?error=400
+ErrorDocument 401 http://www.mazetd.4xg.net/errors.php?error=401
+ErrorDocument 403 http://www.mazetd.4xg.net/errors.php?error=403
+ErrorDocument 404 http://www.mazetd.4xg.net/errors.php?error=404
+ErrorDocument 500 http://www.mazetd.4xg.net/errors.php?error=500
RewriteEngine on
RewriteBase /
+# Incase someone randomly put .html at the end.
RewriteRule ^([a-z]+)\.html$ /?page=$1 [R,L]
-# // For later use, when we get a domain that we want.
+# Maintains www
RewriteCond %{HTTP_HOST} ^mazetd.4xg\.net
RewriteRule (.*) http://www.mazetd.4xg.net/$1 [R,L]
-
RewriteRule ^([a-z]+)$ /index\.php?page=$1 [QSA,NC]
-# 480 weeks
+# GetMap Re-write
+RewriteRule ^map/(.*)$ /ajax/maps\.ajax\.php?mapid=$1 [QSA,NC]
+
+
+# CSS and JS cache for 480 weeks
<filesMatch "\.(css|js)$">
Header set Cache-Control "max-age=290304000, public"
</filesMatch>
diff --git a/ajax/maps.ajax.php b/ajax/maps.ajax.php
new file mode 100644
index 0000000..d2ae750
--- /dev/null
+++ b/ajax/maps.ajax.php
@@ -0,0 +1,20 @@
+<?
+
+//CACHE HEADERS
+include('../includes/mapclass.php');
+include('../includes/maps.php');
+
+//RETURN MAP w/ CACHE HEADERS
+$mapID = $_GET['mapid'] * 1;
+if (!is_int($mapID)) exit;
+
+$map = new map(getMapCode($mapID), $mapID);
+
+// 62 days
+// $expires = 62*24*60*60
+// header("Pragma: public");
+// header("Cache-Control: maxage=".$expires);
+// header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
+echo json_encode($map);
+
+?> \ No newline at end of file
diff --git a/images/.htaccess b/images/.htaccess
index 05bc7d9..cac0861 100644
--- a/images/.htaccess
+++ b/images/.htaccess
@@ -1,4 +1,7 @@
# 480 weeks
<filesMatch "\.(jpg|jpeg|png|gif)$">
Header set Cache-Control "max-age=290304000, public"
-</filesMatch> \ No newline at end of file
+</filesMatch>
+
+# Incase of missing images
+ErrorDocument 404 http://www.mazetd.4xg.net/images/blank.png?error404=true \ No newline at end of file
diff --git a/index.php b/index.php
index 4eff377..a84fb19 100644
--- a/index.php
+++ b/index.php
@@ -71,7 +71,9 @@ $footerLinks['#top'] = "Back to Top";
//Links appear in order.
$Links['home'] = "Home";
-$Links['scores'] = "Scores";
+//TODO: Delete
+ $Links['oldleaderboard'] = "Old ScorePage...";
+$Links['scores'] = "Scores <i>BETA!</i>";
$Links['challengelist'] = "Challenges <i>BETA!</i>";
//$Links['howtoplay'] = "How to Play";
//$Links['tutorial'] = "Tutorial";
@@ -149,6 +151,11 @@ switch ($request) {
require("pages/howtoplay.php");
break;
+ //TODO: DELETE:
+ case "oldleaderboard":
+ require("pages/oldleaderboard.php");
+ break;
+
//Support older links.
case "leaderboard":
header("Location: $mydomain"."scores?date=".$_GET['date']);