Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I've modifid the URLRewriting.config file in the /config folder, to the following :
<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07"><rewrites>
<add name="Redirect301"
redirect="Domain"
ignoreCase="true" rewriteUrlParameter="ExcludeFromClientQueryString"
virtualUrl="^~/askDetails.aspx?hotel=1537"
redirectMode="Permanent"
destinationUrl="~/ProviderDetails.aspx?Prvdr=1234" />
</rewrites></urlrewritingnet>
However, when I visit the URL, it just takes me to a default 404 error page:
No umbraco document matches the url '
'
. How can I get this working - is the code above wrong?
How I solve this addition of "default.aspx"?
Thanks all.
Here is a 301 redirect XSLT file I am using that essentially does a 301 redirect. Create a macro from this with a parameter called redirectUrl
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:redir="http://www.umbraco.org/redir" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxsl msxml redir umbraco.library"> <xsl:output method="xml" omit-xml-declaration="yes" /> <xsl:param name="currentPage"/> <xsl:template match="/"> <xsl:variable name="redirectUrl" select="/macro/redirectUrl" /> <xsl:if test="$redirectUrl != ''"> <xsl:value-of select="redir:Redirect($redirectUrl)" /> </xsl:if> </xsl:template> <msxsl:script implements-prefix="redir" language="C#"> <msxml:assembly name="System.Web" /> <msxml:using namespace="System.Web" /> <![CDATA[ /// <summary> /// Redirects a string site to a 301 Redirect /// </summary> /// <param name="url">String to redirect page to (usually passed via macro parameter)</param> /// <returns>String.Empty</returns> public string Redirect(string url){ System.Web.HttpContext.Current.Response.Status = "301 Moved Permanently"; System.Web.HttpContext.Current.Response.AddHeader("Location", url.ToString()); return String.Empty; } ]]> </msxsl:script></xsl:stylesheet>
Create a document type for your new 301 Redirects. Inside the doctype create a textstring property and inside the template of the doctype add:
<umbraco:Macro redirectUrl="[#PropertyAliasHere]" Alias="MacroAliasHere" runat="server">umbraco:Macro>
Thanks for your help.
When you wrote "Create a document type for your new 301 Redirects" Do you mean that I have to open pages under the site content node for each old url page which I redirect?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
301 redirect not working.
Hi,
I've modifid the URLRewriting.config file in the /config folder, to the following :
<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
<add name="Redirect301"
redirect="Domain"
ignoreCase="true" rewriteUrlParameter="ExcludeFromClientQueryString"
virtualUrl="^~/askDetails.aspx?hotel=1537"
redirectMode="Permanent"
destinationUrl="~/ProviderDetails.aspx?Prvdr=1234" />
</rewrites>
</urlrewritingnet>
However, when I visit the URL, it just takes me to a default 404 error page:
No umbraco document matches the url '
'
. How can I get this working - is the code above wrong?
How I solve this addition of "default.aspx"?
Thanks all.
Here is a 301 redirect XSLT file I am using that essentially does a 301 redirect. Create a macro from this with a parameter called redirectUrl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:redir="http://www.umbraco.org/redir"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxsl msxml redir umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="redirectUrl" select="/macro/redirectUrl" />
<xsl:if test="$redirectUrl != ''">
<xsl:value-of select="redir:Redirect($redirectUrl)" />
</xsl:if>
</xsl:template>
<msxsl:script implements-prefix="redir" language="C#">
<msxml:assembly name="System.Web" />
<msxml:using namespace="System.Web" />
<![CDATA[
/// <summary>
/// Redirects a string site to a 301 Redirect
/// </summary>
/// <param name="url">String to redirect page to (usually passed via macro parameter)</param>
/// <returns>String.Empty</returns>
public string Redirect(string url){
System.Web.HttpContext.Current.Response.Status = "301 Moved Permanently";
System.Web.HttpContext.Current.Response.AddHeader("Location", url.ToString());
return String.Empty;
}
]]>
</msxsl:script>
</xsl:stylesheet>
Create a document type for your new 301 Redirects. Inside the doctype create a textstring property and inside the template of the doctype add:
<umbraco:Macro redirectUrl="[#PropertyAliasHere]" Alias="MacroAliasHere" runat="server">umbraco:Macro>
Hi,
Thanks for your help.
When you wrote "Create a document type for your new 301 Redirects" Do you mean that I have to open pages under the site content node for each old url page which I redirect?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.