diff --git a/core/SSViewer.php b/core/SSViewer.php
index 0a5143910..9606e6ce2 100644
--- a/core/SSViewer.php
+++ b/core/SSViewer.php
@@ -371,16 +371,18 @@ class SSViewer extends Object {
array_pop(SSViewer::$topLevel);
if(isset($_GET['debug_profile'])) Profiler::unmark("SSViewer::process", " for $template");
-
+
// If we have our crazy base tag, then fix # links referencing the current page.
- if(strpos($output, '";
- } else {
- $thisURLRelativeToBase = strip_tags($_SERVER['REQUEST_URI']);
+ if(SSViewer::$options['rewriteHashlinks']) {
+ if(strpos($output, '";
+ } else {
+ $thisURLRelativeToBase = strip_tags($_SERVER['REQUEST_URI']);
+ }
+ $output = preg_replace('/(]+href *= *)"#/i', '\\1"' . $thisURLRelativeToBase . '#', $output);
}
- $output = preg_replace('/(+]href *= *)"#/i', '\\1"' . $thisURLRelativeToBase . '#', $output);
- }
+ }
return $output;
}