<![CDATA[ [SOLVED] Links in the content when using TinyMCE (a.k.a "Beware the base tag") - My Forums]]> https://forums.modx.com/thread/?thread=45459 <![CDATA[Re: [SOLVED] Links in the content when using TinyMCE (a.k.a &quot;Beware the base tag]]> https://forums.modx.com/thread/45459/solved-links-in-the-content-when-using-tinymce-a-k-a-beware-the-base-tag#dis-post-263035 PaulSuckling Nov 20, 2009, 08:54 AM https://forums.modx.com/thread/45459/solved-links-in-the-content-when-using-tinymce-a-k-a-beware-the-base-tag#dis-post-263035 <![CDATA[Re: Links in the content when using TinyMCE]]> https://forums.modx.com/thread/45459/solved-links-in-the-content-when-using-tinymce-a-k-a-beware-the-base-tag#dis-post-263034 Sometimes it is good to read more than to write more smiley
You probably can delete the topic or change it to something like "be careful with base tag" smiley]]>
ddim Nov 20, 2009, 08:20 AM https://forums.modx.com/thread/45459/solved-links-in-the-content-when-using-tinymce-a-k-a-beware-the-base-tag#dis-post-263034
<![CDATA[Re: Links in the content when using TinyMCE]]> https://forums.modx.com/thread/45459/solved-links-in-the-content-when-using-tinymce-a-k-a-beware-the-base-tag#dis-post-263033
I don’t understand why you are getting URLs of the form: http://sitename/en/assets

Are you using a <base href=... tag? If so, what are you using?

I would suggest using:
<base href="(yams_server)"></base>

That way no rewrite rules should be necessary.]]>
PaulSuckling Nov 19, 2009, 01:41 PM https://forums.modx.com/thread/45459/solved-links-in-the-content-when-using-tinymce-a-k-a-beware-the-base-tag#dis-post-263033
<![CDATA[ [SOLVED] Links in the content when using TinyMCE (a.k.a &quot;Beware the base tag&quot;)]]> https://forums.modx.com/thread/45459/solved-links-in-the-content-when-using-tinymce-a-k-a-beware-the-base-tag#dis-post-263032 The URL with default TinyMCE configuration (Path Options = docrelative) is "assets/files/docname.pdf".
This link is converted to http://sitename/en/assets... which is "wrong"
To make the links work correctly the configuration of TinyMCE should be changed to (Path Options = rootrelative)
After that the urls will have starting slash and will work correctly.
To make the life easier additional rewrite rules can be put like:

#Remove language codes from assets

RewriteCond ${REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
RewriteRule ^en/assets(.*)$ assets$1 [L,QSA]
RewriteCond ${REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
RewriteRule ^bg/assets(.*)$ assets$1 [L,QSA]

With these rules you should not care about the configuration of the editor (or in case some hardcoded relative links to the assets are put somewhere)

(I’m not mod_rewrite specialist and may be the rules are not perfect, but in my case they do the job.)

Forgot to mention that this is valid for root mode of yams]]>
ddim Nov 19, 2009, 03:16 AM https://forums.modx.com/thread/45459/solved-links-in-the-content-when-using-tinymce-a-k-a-beware-the-base-tag#dis-post-263032