I need to do something where the backend user can type specific short urls like xxx.com/shorttekt (maybe on a special pagetype that holds key/values or so...). When hit in browser, the url typed, will then do a permanent 301 redirect to an existing page with longer url like xxx.com/folder/folder/folder/shorttekt.
The way I was thinking that you could do it was by creating a page in your site structure, like xxx.com/shorttekt, and then make a 301 redirect with the 301 URL Tracker package to the page with the long url. xxx.com/folder/folder/folder/shorttekt.
I actually ended up with a pagetype that holds one multi url picker. The website editor can here create ´n amount of items that hold: a "title" (the shorttekt i need) and a link to an internal page (the page i need to redirect to). And then... When my landing page is loaded i do something like this to find the shorttext and create a redirect:
public void Page_Init(object o, EventArgs e) {
DynamicNode dn = new DynamicNode(xxxx); // get smarturl page and find multiurlpicker var urlPicker = uComponents.DataTypes.MultiUrlPicker.Dto.MultiUrlPickerState.Deserialize(dn.GetPropertyValue("xxx")); string strCurrent= Request.Url.AbsolutePath; string strName = strCurrent.Substring(strCurrent.LastIndexOf("/") + 1);
foreach (var item in urlPicker.Items { if (strName.ToLower() == item.Title.ToLower()) { Response.Clear(); Response.StatusCode = 301; Response.RedirectLocation = item.Url; Response.End();
Shortening urls
Hi,
I need to do something where the backend user can type specific short urls like xxx.com/shorttekt (maybe on a special pagetype that holds key/values or so...).
When hit in browser, the url typed, will then do a permanent 301 redirect to an existing page with longer url like xxx.com/folder/folder/folder/shorttekt.
Any ideas?
Hi Amigo,
A possible solution could be use to the 301 URL Tracker package, http://our.umbraco.org/projects/developer-tools/301-url-tracker.
The way I was thinking that you could do it was by creating a page in your site structure, like xxx.com/shorttekt, and then make a 301 redirect with the 301 URL Tracker package to the page with the long url. xxx.com/folder/folder/folder/shorttekt.
Hope this helps,
/Dennis
Hi,
I actually ended up with a pagetype that holds one multi url picker.
The website editor can here create ´n amount of items that hold: a "title" (the shorttekt i need) and a link to an internal page (the page i need to redirect to).
And then... When my landing page is loaded i do something like this to find the shorttext and create a redirect:
public void Page_Init(object o, EventArgs e)
{
DynamicNode dn = new DynamicNode(xxxx); // get smarturl page and find multiurlpicker
var urlPicker = uComponents.DataTypes.MultiUrlPicker.Dto.MultiUrlPickerState.Deserialize(dn.GetPropertyValue("xxx"));
string strCurrent= Request.Url.AbsolutePath;
string strName = strCurrent.Substring(strCurrent.LastIndexOf("/") + 1);
foreach (var item in urlPicker.Items
{
if (strName.ToLower() == item.Title.ToLower())
{
Response.Clear();
Response.StatusCode = 301;
Response.RedirectLocation = item.Url;
Response.End();
}
}
is working on a reply...