diff --git a/HAppS/Helpers/DirBrowse.hs b/HAppS/Helpers/DirBrowse.hs
--- a/HAppS/Helpers/DirBrowse.hs
+++ b/HAppS/Helpers/DirBrowse.hs
@@ -9,6 +9,8 @@
   (browsedir, browsedirHS, browsedir')
 where
 
+import System.FilePath
+
 import HAppS.Server 
 import Control.Monad.Trans (liftIO)
 import System.Directory (doesDirectoryExist,getDirectoryContents,doesFileExist)
@@ -60,7 +62,7 @@
 browsedir' paintdir paintfile diralias syspath = multi [
   ServerPartT $ \rq -> do
     let aliaspath = ( mypathstring . rqPaths $ rq )
-    if (not . isPrefixOf diralias $ aliaspath)
+    if (not $ isPrefixOf (addTrailingPathSeparator diralias) $ (addTrailingPathSeparator aliaspath) )
        then noHandle
        else do
          -- to do: s/rqp/realpath/
diff --git a/HAppS/Helpers/ParseRequest.hs b/HAppS/Helpers/ParseRequest.hs
--- a/HAppS/Helpers/ParseRequest.hs
+++ b/HAppS/Helpers/ParseRequest.hs
@@ -6,20 +6,29 @@
 import qualified Data.Map as M
 import Data.String.Utils (split)
 {- |
-Useful hack for ensuring same behavior between local dev environment (host is localhost) and webserver
-
-getAppUrl \"\/some\/path\" rq => \"http:\/\/localhost:5001\/some\/path\" if I'm local,
-if I'm online it also does the right thing
+Try to return the "home page" of a happs server, basically, the host plus an optional path.
+The "smart" part is trying to deal sanely with HAppS serving behind apache mod rewrite,
+a common situation for me at least
+because it lets you have multiple happs servers listening on different ports, all
+looking to the casual user like they are being served on port 80, and also unblocked by firewalls.
 -}
-getAppUrl :: String -> Request -> String
-getAppUrl path' rq = 
-  let host =  either (const "getAppUrlCantDetermineHost") id $ getHost rq
+smartAppUrl :: String -> Request -> String
+smartAppUrl path' rq =
+  let forwardinghost = getHeaderVal "x-forwarded-server" rq
+      vanillahost = getHeaderVal "host" rq
+      apphost = case forwardinghost of
+        Right h -> h
+        Left _ -> case vanillahost of
+          Right h -> h
+          Left _ -> "getAppUrlCantDetermineHost" --ugly way to propogate error!
       -- trim starting slash if necessary
       path = case path' of
                "" -> ""
                '/':cs -> cs
-               cs -> cs 
-  in render1 [("host",host),("path",path)] "http://$host$/$path$"
+               x -> x
+  in render1 [("apphost",apphost),("path",path)] "http://$apphost$/$path$"
+
+
 
 {- | 
 getHost = getHeaderVal \"host\" 
diff --git a/HAppS/Helpers/Redirect.hs b/HAppS/Helpers/Redirect.hs
--- a/HAppS/Helpers/Redirect.hs
+++ b/HAppS/Helpers/Redirect.hs
@@ -12,7 +12,7 @@
 redirectPath p rq = redirectToUrl $ getAppUrl p rq
 -}
 redirectPath :: String -> Request -> WebT IO Response
-redirectPath p rq = redirectToUrl $ getAppUrl p rq
+redirectPath p rq = redirectToUrl $ smartAppUrl p rq
 
 {- |
 Escape a servrPartT handler by redirecting somewhere
diff --git a/HAppSHelpers.cabal b/HAppSHelpers.cabal
--- a/HAppSHelpers.cabal
+++ b/HAppSHelpers.cabal
@@ -1,5 +1,5 @@
 Name: HAppSHelpers
-Version: 0.8
+Version: 0.9
 License: BSD3
 License-file: bsd3.txt
 Description: Functions I found I was using repeatedly when programming HAppS based web-apps. 
