diff --git a/contrib/emoticons/main.php b/contrib/emoticons/main.php
index b7f666ec..d2f2359a 100644
--- a/contrib/emoticons/main.php
+++ b/contrib/emoticons/main.php
@@ -17,7 +17,7 @@ class Emoticons extends Extension {
 	
 	private function bbcode_to_html($text) {
 		global $config;
-		$data_href = $config->get_string("data_href");
+		$data_href = get_base_href();
 		$text = preg_replace("/:([a-z]*?):/s", " ", $text);
 		return $text;
 	}
diff --git a/core/util.inc.php b/core/util.inc.php
index 93f9474d..ff10b4e9 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -205,6 +205,10 @@ function get_memory_limit() {
 	return $memory;
 }
 
+function get_base_href() {
+	return dirname($_SERVER['SCRIPT_NAME']);
+}
+
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
 * Debugging functions                                                       *
diff --git a/ext/load_ext_data/main.php b/ext/load_ext_data/main.php
index 63ec5373..f443dd44 100644
--- a/ext/load_ext_data/main.php
+++ b/ext/load_ext_data/main.php
@@ -4,7 +4,7 @@ class LoadExtData extends Extension {
 		if(is_a($event, 'PageRequestEvent')) {
 			global $page, $config;
 
-			$data_href = $config->get_string("data_href", './');
+			$data_href = get_base_href();
 
 			foreach(glob("ext/*/style.css") as $css_file) {
 				$page->add_header("");
diff --git a/ext/setup/main.php b/ext/setup/main.php
index 6db65253..13c2ba50 100644
--- a/ext/setup/main.php
+++ b/ext/setup/main.php
@@ -164,7 +164,6 @@ class Setup extends Extension {
 			$sb->add_text_option("title", "Site title: ");
 			$sb->add_text_option("front_page", "
", $text);
 		return $text;
 	}
diff --git a/core/util.inc.php b/core/util.inc.php
index 93f9474d..ff10b4e9 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -205,6 +205,10 @@ function get_memory_limit() {
 	return $memory;
 }
 
+function get_base_href() {
+	return dirname($_SERVER['SCRIPT_NAME']);
+}
+
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
 * Debugging functions                                                       *
diff --git a/ext/load_ext_data/main.php b/ext/load_ext_data/main.php
index 63ec5373..f443dd44 100644
--- a/ext/load_ext_data/main.php
+++ b/ext/load_ext_data/main.php
@@ -4,7 +4,7 @@ class LoadExtData extends Extension {
 		if(is_a($event, 'PageRequestEvent')) {
 			global $page, $config;
 
-			$data_href = $config->get_string("data_href", './');
+			$data_href = get_base_href();
 
 			foreach(glob("ext/*/style.css") as $css_file) {
 				$page->add_header("");
diff --git a/ext/setup/main.php b/ext/setup/main.php
index 6db65253..13c2ba50 100644
--- a/ext/setup/main.php
+++ b/ext/setup/main.php
@@ -164,7 +164,6 @@ class Setup extends Extension {
 			$sb->add_text_option("title", "Site title: ");
 			$sb->add_text_option("front_page", "
Front page: ");
 			$sb->add_text_option("base_href", "
Base URL: ");
-			$sb->add_text_option("data_href", "
Data URL: ");
 			$sb->add_text_option("contact_link", "
Contact URL:");
 			$sb->add_choice_option("theme", $themes, "
Theme: ");
 			// $sb->add_int_option("anon_id", "
Anonymous ID: "); // FIXME: create advanced options page
diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php
index 7ae05a60..3b9085bb 100644
--- a/themes/danbooru/layout.class.php
+++ b/themes/danbooru/layout.class.php
@@ -46,7 +46,7 @@ class Layout {
 		global $config;
 		$theme_name = $config->get_string('theme');
 		$base_href = $config->get_string('base_href');
-		$data_href = $config->get_string('data_href');
+		$data_href = get_base_href();
 		$contact_link = $config->get_string('contact_link');
 		$version = $config->get_string('version');
 
diff --git a/themes/default/layout.class.php b/themes/default/layout.class.php
index 5ffc79d3..84744caa 100644
--- a/themes/default/layout.class.php
+++ b/themes/default/layout.class.php
@@ -4,7 +4,7 @@ class Layout {
 	function display_page($page) {
 		global $config;
 		$theme_name = $config->get_string('theme', 'default');
-		$data_href = $config->get_string('data_href', './');
+		$data_href = get_base_href();
 		$contact_link = $config->get_string('contact_link');
 		$version = "Shimmie-".VERSION;