diff --git a/src/main/java/org/olat/core/commons/modules/bc/commands/CmdEditMeta.java b/src/main/java/org/olat/core/commons/modules/bc/commands/CmdEditMeta.java
index 35995dea582bfd7db40f48c9089a8306912dc214..771060e62d66ab4747a279623068480bf7debe79 100644
--- a/src/main/java/org/olat/core/commons/modules/bc/commands/CmdEditMeta.java
+++ b/src/main/java/org/olat/core/commons/modules/bc/commands/CmdEditMeta.java
@@ -119,7 +119,10 @@ public class CmdEditMeta extends BasicController implements FolderCommand {
 	private String getResourceURL(WindowControl wControl) {
 		String path = "path=" + folderComponent.getCurrentContainerPath();
 		if(currentItem != null) {
-			path += "/" + currentItem.getName();
+			if(path.charAt(path.length() - 1) != '/') {
+				path += currentItem.getName();
+			}
+			path += currentItem.getName();
 		}
 		OLATResourceable ores = OresHelper.createOLATResourceableTypeWithoutCheck(path);
 		WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, wControl);
diff --git a/src/main/java/org/olat/modules/wiki/gui/components/wikiToHtml/WikiMarkupRenderer.java b/src/main/java/org/olat/modules/wiki/gui/components/wikiToHtml/WikiMarkupRenderer.java
index 2db789b8f2d47a58bc35ea8661a31a1a7099407e..2b78d36222d7562c4e9e74cf5ee1874d302dfaa8 100644
--- a/src/main/java/org/olat/modules/wiki/gui/components/wikiToHtml/WikiMarkupRenderer.java
+++ b/src/main/java/org/olat/modules/wiki/gui/components/wikiToHtml/WikiMarkupRenderer.java
@@ -40,6 +40,7 @@ import org.olat.core.gui.render.Renderer;
 import org.olat.core.gui.render.StringOutput;
 import org.olat.core.gui.render.URLBuilder;
 import org.olat.core.gui.translator.Translator;
+import org.olat.core.helpers.Settings;
 import org.olat.core.logging.OLATRuntimeException;
 import org.olat.core.util.Formatter;
 
@@ -112,7 +113,8 @@ public class WikiMarkupRenderer extends DefaultComponentRenderer {
 		sb.append("</div>");
 		//set targets of media, image and external links to target "_blank" 
 		sb.append("<script type=\"text/javascript\">/* <![CDATA[ */ ");
-		sb.append("changeAnchorTargets('").append(uniqueId).append("');");
+		String instanceUrl = Settings.getServerContextPathURI();
+		sb.append("changeAnchorTargets('").append(uniqueId).append("','").append(instanceUrl).append("');");
 		sb.append("/* ]]> */</script>");
 	}
 }
diff --git a/src/main/webapp/static/js/openolat/wiki.js b/src/main/webapp/static/js/openolat/wiki.js
index 43383f118c8a57e5d25ea903e38937a5888720f0..d4c3c1d3161aa256773dd5c3a98f12b82f64ded6 100644
--- a/src/main/webapp/static/js/openolat/wiki.js
+++ b/src/main/webapp/static/js/openolat/wiki.js
@@ -9,7 +9,7 @@ if (clientPC.indexOf('opera') != -1) {
 	var is_opera_seven = (window.opera && document.childNodes);
 }
 
-function changeAnchorTargets(id) {
+function changeAnchorTargets(id, hostUrl) {
 	jQuery('a', jQuery('#' + id)).each(function(index, el) {
 		var anchor = jQuery(el);
 		var openInNewWindow = false;
@@ -28,7 +28,9 @@ function changeAnchorTargets(id) {
 		//open media links in new window, but only if file exists
 		if (anchor.attr("title")) {
 			var href = anchor.attr("href");
-			if (!anchor.attr("class") && anchor.attr("title").indexOf("Media:") != -1) { //normal media link file found
+			if(href.indexOf(hostUrl) == 0) {
+				openInNewWindow = false;
+			} else if (!anchor.attr("class") && anchor.attr("title").indexOf("Media:") != -1) { //normal media link file found
 				openInNewWindow = true;
 				//modify link to non ajax mode as opening in new window with ajax mode on fails
 				if (href.indexOf(":1/") != -1) {