Fixing Relative URLs in MODx and TinyMCE
From MODx Wiki
Contents |
Diagnosis
In MODx 0.9.5 rev 1655 and earlier, some users have been having problems with relative URLs and image linking via the browser. Here are some solutions to try.
This article is especially pertinent if you are having problems where setting "relative URLs" off prefixes all your settings with /manager/, but with the setting on it causes browser-sent images or files prefixed with ../assets/ 67952539137297786696437
If you're having Problems with TinyMCE prefixing your relative urls with /manager/, look at How to prevent TinyMCE from prefixing relative URLs with /manager/
Configuration Settings
Make sure these settings are set:
Friendly URL Settings
- Use friendly URLs: Yes
- Use friendly alias path: Yes
- Allow duplicate aliases: Yes
Interface & Editor Settings
- Resource Path: /assets/ (or prefixed with the subdir name if necessary)
- Resource URL: /assets/ (or prefixed with the subdir name if necessary)
Miscellaneous Settings
- Rewrite image paths? No
(this last setting is crucial)
TinyMCE Config Settings
In the file assets/plugins/tinymce/jscripts/tiny_mce/tiny_mce.js
(You might need to rename that file to tiny_mce_backup.js, and duplicate tiny_mce_src.js and rename to tiny_mce.js, since the original file is compressed)
Make sure that the line:
this._def("convert_urls",true);
is changed to:
this._def("convert_urls",false);
The McPuk connector
As a last ditch effort, sometimes making sure that the "urlprefix" variable of the RichTextEditor's config is set correctly may solve the problem. This is especially the case if you get the bug where you click the image in the browser, and it returns into the editor prefixed with /manager/ or something similar.
In the file:
manager/media/browser/mcpuk/connectors/php/config.php
There should be at line 76 or so the line:
$fckphp_config['urlprefix'] = (substr($rb_base_url,-1)=="/") ? substr($rb_base_url,0,-1):$rb_base_url;
You might need to change that line to something similar:
$fckphp_config['urlprefix'] = "/assets";
OR if you aren't installing MODx in the root directory, (for example in /mysite/) this would work:
$fckphp_config['urlprefix'] = "/mysite/assets";
Make sure to not erase the prior line, but just comment it out.
