Main Content

Magnolia Community Forums: Development: Friendly URLs


  • gzalys
    gzalys
    Full name: Gediminas Zalys
    Posts: 27
    Last post: Nov 23, 2016 7:04:41 AM
    Registered on: Aug 13, 2015
    Friendly URLs
    #1 by gzalys on Aug 9, 2016 12:38:07 PM

    Whats the best way to get rid of the magnoliaAuthor, magnoliaPublic prefixes to URLs?
    From www.website.com/magnoliaPublic
    To www.website.com

    I was thinking of just renaming the war files to ROOT, but this wont do the job as i have different magnolia.properties files that get picked based on this naming convention of war files.

    Appreciate your support!

  • gzalys
    gzalys
    Full name: Gediminas Zalys
    Posts: 27
    Last post: Nov 23, 2016 7:04:41 AM
    Registered on: Aug 13, 2015
    Re: Friendly URLs
    #2 by gzalys on Aug 10, 2016 10:43:31 AM

    Found the solution by using context parameters, works quite nicely i would say.

    Add this to your web.xml

    <context-param>
    <param-name>magnolia.initialization.file</param-name>
    <param-value>
    WEB-INF/config/${servername}/${contextParam/magnoliaInstance}/magnolia.properties,
    WEB-INF/config/${servername}/magnolia.properties,
    WEB-INF/config/${contextParam/magnoliaInstance}/magnolia.properties,
    WEB-INF/config/default/magnolia.properties
    </param-value>
    </context-param>



    I have split my configuration directories to something like this:
    config/testAuthor
    config/testPublic
    config/prodAuthor
    config/prodPublic


    Then on each tomcat instance (test author, prod public etc) in the tomcat/conf/Catalina/localhost/ i added a file called ROOT.xml
    in the file i have defined ${contextParam/magnoliaInstance} variable specific to each instance:


    <Context docBase="../my-app/my-app.war" reloadable="false">
    <Parameter name="magnoliaInstance" value="prodAuthor" override="false"/>
    </Context>


    Worked like a charm!

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/