diff --git a/core/SSViewer.php b/core/SSViewer.php
index 3690d26c4..1f810d460 100644
--- a/core/SSViewer.php
+++ b/core/SSViewer.php
@@ -365,9 +365,11 @@ class SSViewer extends Object {
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, '+]href *= *)"#/i', '\\1"' . $thisURLRelativeToBase . '#', $output);
+ if($this->rewriteHashlinks && self::$options['rewriteHashlinks']) {
+ if(strpos($output, '+]href *= *)"#/i', '\\1"' . $thisURLRelativeToBase . '#', $output);
+ }
}
return $output;