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.
-
☆ A M B ☆
- 24,524 Posts
Are you using multilanguage contexts? Is the "news" resource the child of the "en" resource?
Also have the same problem with multiple context.
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.
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.
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?
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.