Main Content

Magnolia Community Forums: Get help with Magnolia: Problem with URL Mapping


  • rldw
    rldw
    Posts: 4
    Last post: May 26, 2017 10:50:48 AM
    Registered on: May 24, 2017
    Problem with URL Mapping
    #1 by rldw on May 24, 2017 12:09:48 PM

    Hello,

    I recently took over an existing Magnolia site, which I'm completely unfamiliar with. Since then a problem came up which I cannot resolve.

    Usually all URLs on the site would be something like domain.com/home/page. However, the client doesn't want the /home portion in the URL. Thus the old developers implemented a function that strips the /home portion of each URL. So on the public instance each URL looks like domain.com/site, but once you request that page Magnolia automatically redirects the user to domain.com/home/site

    My question now is: how can I prevent Magnolia from redirecting and from adding the /home to the url?

  • ahietala
    ahietala
    Full name: Antti Hietala
    Posts: 338
    Last post: Jun 8, 2017 11:51:08 AM
    Re: Problem with URL Mapping
    #2 by ahietala on May 24, 2017 1:02:16 PM

    how can I prevent Magnolia from adding the /home to the url?


    Hi rldw,

    This is typically done with a URI mapping in the site definition. Open the Site app and define a mapping that looks something like this:


    my-site
    - mappings
    - website
    URIPrefix=/
    handlePrefix=/home
    repository=website


    You may already have such a mapping. Make sure it is published to the public instances.

    Docs that may help:
    https://documentation.magnolia-cms.com/display/DOCS/URI+mapping#URImapping-URItorepositorymapping
    https://documentation.magnolia-cms.com/display/DOCS/Site+definition
    https://documentation.magnolia-cms.com/display/DOCS/Site+app

    --Antti

  • rldw
    rldw
    Posts: 4
    Last post: May 26, 2017 10:50:48 AM
    Registered on: May 24, 2017
    Re: Problem with URL Mapping
    #3 by rldw on May 24, 2017 3:21:19 PM

    Hey Antii,

    thanks for the quick response. Unfortunately it didn't solve my problem. It also turned out that my description wasn't quite accurate.

    Consider the following page hierarchy:

    home
    - page1
    - page2
    - page3

    When I navigate to domain.com/page1 I'm 301 redirected to domain.com/home/page1 and the page is served. But when I navigate to domain.com/page2, for example, I'm not redirected and the page is served just fine, also. So the behaviour that I'm being redirected to /home/* only affects some nodes (and their subnodes).

    As you suggested, I had a look at the site definitions. However, there were no useful site definitions (only unpublished ones and none of them looked like a proper template). I thus added a new node including the mappings, but with no luck: the problem persists. Do I need to add the site definition via the site app?

    I also tried editing Configuration -> server -> URI2RepositoryMapping -> mappings -> website and set URIPrefix=/ and handlePrefix=/home (also to /home/); but again no luck.

    Any further suggestions how I can fix this?

    Thanks
    rldw

  • ahietala
    ahietala
    Full name: Antti Hietala
    Posts: 338
    Last post: Jun 8, 2017 11:51:08 AM
    Re: Problem with URL Mapping
    #4 by ahietala on May 24, 2017 3:41:07 PM

    Go to Tools > About Magnolia > Virtual URI Mappings (tab). It's a list of virtual URI mappings from all modules. Look for the "page1" path that gets 301 redirected. If you find it on the list, copy the fromURI or toURI value and search for them in the Configuration app. You should find the module that defines the redirect.

    --Antti

  • rldw
    rldw
    Posts: 4
    Last post: May 26, 2017 10:50:48 AM
    Registered on: May 24, 2017
    Re: Problem with URL Mapping
    #5 by rldw on May 26, 2017 10:45:17 AM

    The "About Magnolia" App doesn't have a Virtual URI Mapping tab, but Tools > Config Info has such a section. But again no luck there. Only RSS and .magnolia stuff. I also searched for the affected pages in the config, but it didn't came up with anything.

  • rldw
    rldw
    Posts: 4
    Last post: May 26, 2017 10:50:48 AM
    Registered on: May 24, 2017
    Re: Problem with URL Mapping
    #6 by rldw on May 26, 2017 10:50:48 AM

    Btw I'm using 5.3.13 Community Edition

  • ahietala
    ahietala
    Full name: Antti Hietala
    Posts: 338
    Last post: Jun 8, 2017 11:51:08 AM
    Re: Problem with URL Mapping
    #7 by ahietala on May 29, 2017 8:55:09 AM

    Maybe the redirect is defined outside of Magnolia? Do you have a web server such as Apache in front of the public instance? Does the redirect only happen on public instances or also on the author instance? You can try requesting the website on the author instance by stripping /.magnolia/admincentral from the URL.

    Compare:
    https://demoauthor.magnolia-cms.com/.magnolia/admincentral#shell:applauncher:;
    https://demoauthor.magnolia-cms.com/travel.html

    --Antti

    P.S. Magnolia 5.3 will run out of supported life on June 30, 2017. Consider upgrading to 5.5. It's a bigger community of users who can help.

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/