Re-direct any static/archive requests to static.

BUG=chromium:259123
TEST=Local devserver serving from /images and tried staging
and accessing data from both static and static/archive.

Change-Id: Ice4fcfeac8a2b3787187c0261dc55038c26ea4ed
Reviewed-on: https://gerrit.chromium.org/gerrit/61599
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Joy Chen <joychen@chromium.org>
Reviewed-by: Alex Miller <milleral@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
diff --git a/apache/htaccess b/apache/htaccess
index 3e241f2..3306551 100644
--- a/apache/htaccess
+++ b/apache/htaccess
@@ -6,5 +6,11 @@
 # don't map to an actual file.
 
 RewriteEngine on
+
+# Remove archive from any static/archive paths.
+RewriteCond %{REQUEST_URI} ^/static/archive
+RewriteRule ^static/archive(.*) http://127.0.0.1:8082/static$1 [proxy]
+
+# Re-direct any non-static requests to the devserver on 8080.
 RewriteCond %{REQUEST_URI} !^/static
 RewriteRule ^(.*) http://127.0.0.1:8080/$1 [proxy]
diff --git a/apache/setup_apache.sh b/apache/setup_apache.sh
index 75ef688..2df2540 100755
--- a/apache/setup_apache.sh
+++ b/apache/setup_apache.sh
@@ -44,10 +44,10 @@
 
   # Setup devserver archive location.
   local image_root="${DEFAULT_IMAGE_ROOT}"
-  [ -n "${1}" ] && image_root="${1}"
+  [ -n "${1}" ] && image_root="$(readlink -f "${1}")"
 
   local static_dir="${ARCHIVE_ROOT}"/static
-  if [ -e "${static_dir}" ]; then
+  if [ -h "${static_dir}" ]; then
     unlink "${static_dir}"
   fi
 
@@ -57,9 +57,6 @@
     unlink "${static_dir}/archive"
   fi
 
-  # Create a link to archive that points back to the same dir.
-  ln -sf "${image_root}" "${static_dir}/archive"
-
   /etc/init.d/apache2 restart
 }