We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52362
    • 2 Posts
    Hello. I use Modx more than 3 years, now I have a problem, that can not fix more than 2 days. After creating modx 2.5 project I turned on FRIENDLY URL. But, my url is generated with the prefix of context in Wayfinder and [[++site_url]]. For example:

    www.mysite.com
    www.mysite.com/en/news

    If you look through to the second link, you can see "en" inside the url. How to remove this "en"? In config.core.php my base url is "/".
    I cleared the cache, but not helped. I use nginx server. If I manually type the url like: www.mysite.com/news it will work.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Are you using multilanguage contexts? Is the "news" resource the child of the "en" resource?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 52362
        • 2 Posts
        Quote from: sottwell at Jun 06, 2016, 04:06 AM
        Are you using multilanguage contexts? Is the "news" resource the child of the "en" resource?

        Please look through the attached photo. [ed. note: mraghayev last edited this post 10 years, 4 months ago.]
          • 42042
          • 140 Posts
          Also have the same problem with multiple context.
            • 3749
            • 24,544 Posts
            First, if you have multiple front-end contexts, your the tag used in your base href statement should be called uncached. In other words, you want this in the head section of all templates:

            <base href="[[!++site_url]]" />


            To eliminate the middle of the URL, there is a System Setting for controling that. I think the name is friendly_alias_urls, but it may have a different name in your version of MODX.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 42042
              • 140 Posts
              Quote from: BobRay at Jun 28, 2016, 05:02 PM
              First, if you have multiple front-end contexts, your the tag used in your base href statement should be called uncached. In other words, you want this in the head section of all templates:

              <base href="[[!++site_url]]">


              To eliminate the middle of the URL, there is a System Setting for controling that. I think the name is friendly_alias_urls, but it may have a different name in your version of MODX.

              Thanks BobRay. I've applied your tips so the uncached site_URL and turn off/on the friendly_alias_urls. Unfortunately the issue is still there.

              My page URL on the default context is: www.website.com and in the English context www.website.com/eng/. So it still messes up the assets paths like: www.website.com/eng/assets/ instead of www.website.com/assets/.

              Any ideas? Maybe hardcode the base URL?

              Thanks so much.
                • 3749
                • 24,544 Posts
                I don't think hardcoding the URL will help. There is a System Setting that controls whether the intermediate path is shown or just the site_url followed by the alias. I think the setting's name has changed, but if you go to System Settings and put 'Friendly' (without the quotes) in the search box at the upper right and press enter, it should turn up. You may have to manually delete the files in the core/cache directory to get the change to show up.

                I think it's called use_alias_path. If that doesn't show up when you enter Friendly, try use_alias_path in the search box.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 42042
                  • 140 Posts
                  Hi BobRay,

                  Still no luck. I did found the setting but it still puts the base URL to website.com/eng/ instead of website.com/. I think its because of my context setting, see attachment. I use this in combination with Xrouting to create multiple languages.

                  Any advice?
                    • 3749
                    • 24,544 Posts
                    Have you tried removing the 'eng/' from the site_url context setting? I'm not sure it would work. As long at that's there, you're going to see that in the URL. It may be possible to create another plugin to remove it, but that could have some unpleasant side effects. You may have to live with the eng/. It's fairly common in multi-language sites.

                    This is another option: https://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/create-a-multilingual-website-with-migxmultilang. I don't know if it would allow you to remove the eng/ or not. The creator, Bruno17, would know.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 42042
                      • 140 Posts
                      Quote from: BobRay at Jul 01, 2016, 12:48 AM
                      Have you tried removing the 'eng/' from the site_url context setting? I'm not sure it would work. As long at that's there, you're going to see that in the URL. It may be possible to create another plugin to remove it, but that could have some unpleasant side effects. You may have to live with the eng/. It's fairly common in multi-language sites.

                      This is another option: https://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/create-a-multilingual-website-with-migxmultilang. I don't know if it would allow you to remove the eng/ or not. The creator, Bruno17, would know.

                      Yes did try that but that links wont work. I will look into Migx as well. The /Eng/ is not a problem only that its messes up the assets links. I have some options, what would you advice?

                      1. Create new system setting [[++assets_path]] == website.com/assets and use that for assets
                      2. Create a rewrite in .htaccess (don't have much knowledge on that)
                      3. Hardcode the base URL

                      So the only problem is that the website can't find my assets because its searching in /Eng/assets/ instead of assets/.


                      Thanks so much for your time.