diff --git a/httprl.module b/httprl.module
index 0d9fb03..e48a750 100755
--- a/httprl.module
+++ b/httprl.module
@@ -374,6 +374,8 @@ function httprl_build_url_self($path = '', $detect_schema = FALSE) {
           $level++;
           $new_drupal_root = _httprl_build_drupal_root($level);
           if ($new_drupal_root == $drupal_root) {
+            // Use no subdirectories if nothing worked.
+            $drupal_root = _httprl_build_drupal_root();
             break;
           }
           $drupal_root = $new_drupal_root;
