Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Saied 349 posts 674 karma points
    Jun 08, 2016 @ 20:30
    Saied
    0

    Have umbraco navigate to another page when using a different url?

    I have the following url:

    http://stage.sctflash.com/user

    but when the user enters this url or clicks it, I actually want them to go to:

    http://stage.sctflash.com/user/account instead. How can I do this with Umbraco or UrlReWriting?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 08, 2016 @ 21:28
    Dennis Aaen
    0

    Hi Saied

    I think that you should have a look at the 301 url tracker package

    https://our.umbraco.org/projects/developer-tools/301-url-tracker/

    With this package you have the option to create redirects

    Hope this can be a solution.

    /Dennis

  • Saied 349 posts 674 karma points
    Jun 08, 2016 @ 21:30
    Saied
    0

    Hi Dennis,

    I am using Umbraco 7.3. Looks like this package is only compatible 29%.

    Thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 08, 2016 @ 21:35
    Dennis Aaen
    0

    Hi Saied,

    This is people who vote for the package, and they vote if it's work for them.

    You could try to give the package a spin on a test site to see if you can use it for your purpose.

    Or try to use the other option that I have linked to.

    /Dennis

  • Saied 349 posts 674 karma points
    Jun 09, 2016 @ 01:02
    Saied
    0

    Thanks Dennis,

    For the past year, I kept thinking that was the compatibility percent lol. You always learn something new.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 08, 2016 @ 21:31
  • Marcio Goularte 389 posts 1362 karma points
    Jun 08, 2016 @ 22:27
  • Saied 349 posts 674 karma points
    Jun 09, 2016 @ 01:04
    Saied
    0

    I really need to only do this to a couple pages. I don't need many redirects, so I guess this can be an option. If I want www.abc.com/user to redirect to www.abc.com/user/account, do I just put /user/account in the url alias?

    Maybe I am doing it wrong, but www.abc.com/user is a page that does in fact exist, so I created a property called umbracoUrlAlias and on my account node which is located at /user/account, I put user in the umbraco url alias textbox, but when I type in www.abc.com/user, it goes to www.abc.com/user and not www.abc.com/user/account. If I put in a non-existing node like test, it goes to www.abc.com/user/account.

  • Marcio Goularte 389 posts 1362 karma points
    Jun 09, 2016 @ 02:38
    Marcio Goularte
    0

    umbracourlalias does not redirect. This property creates an alternative URL for the page content. When entered www.abc.com/user/account browser displays the contents of www.abc.com/user. To rewrite you need to create a rule in config/UrlRewriting

    http://www.codeshare.co.uk/blog/how-to-create-url-rewrite-rules-in-umbraco/
    

    Or using UrlProvider and ContentFinder

    http://24days.in/umbraco/2014/urlprovider-and-contentfinder/
    
  • David Armitage 510 posts 2082 karma points
    Jun 09, 2016 @ 04:40
    David Armitage
    0

    Hi,

    If its just a quick re-direct on one or two pages I probably wouldn't bother installing any packages. Just add a rewrite rule to your web.config within system.webServer

    E.g

    <system.webServer>
        <rewrite>
              <rules>
                <rule name="User Redirect Rule">
                  <match url="user" />
                  <action type="Rewrite" url="/user/account" />
                </rule> 
              </rules>
        </rewrite>
    </system.webServer>
    

    There are some other properties available so you might want to have a play. I am pretty sure something like this will work well for you though. Done it myself a few times for other projects.

    If you have lots of re-directs you need to manage then there might be an Umbraco packages available that does this better. I am not too sure though.

    The way how I've managed re-directs for multiple pages in the past is by having a string field on every page document type called redirectToPage. I then add a macro to the master page as per below.

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @{
        string redirectToPage = Model.MacroParameters["redirectToPage"] != null ? Model.MacroParameters["redirectToPage"].ToString() : string.Empty; 
        if (!string.IsNullOrEmpty(redirectToPage))
        {
            Response.Redirect(redirectToPage.ToString(), false);
            Response.StatusCode = 301;
            Response.End();
        }
    }
    

    Basically it checks if there is a re-direct set on the page and if so then run a redirect.

    Hope this helps

    Kind Regards

    David

  • 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.

Please Sign in or register to post replies