Making Drupal's TinyMCE module produce domain absolute URLs

By default Drupal's excellent TinyMCE module will convert domain aboslute URLs (e.g. http://www.stress-free.co.nz/sites/default/files/u63/drupal_logo.png) into plain old absolute URLs (e.g. /files/u63/drupal_logo.png). Generally this is not a problem so long as you do not want to use an external web service such as FeedBurner for your RSS feeds. Unfortunately FeedBurner does not handle plain old absolute URLs very well. This is because the domain name for your FeedBurner enabled RSS feed is feeds.feedburner.com and any absolute (or relative) links in your post try resolving to this domain name rather than the original website.

In a perfect world FeedBurner would parse incoming RSS feeds and replace absolute/relative URLs with domain aboslute URLs to ensure everything works (or maybe it can and I haven't figured out how to do this). Fixing this problem in Drupal when you are using the TinyMCE editor is a little tricky because TinyMCE tries to be helpful by replacing your domain absolute URLs. To get around this we have to tell TinyMCE to leave these URLs alone and convert any new absolute or relative URLs into their domain absolute equivalents.

To achieve this edit the modules/tinymce/tinymce.module file in your Drupal site and change the following lines (line numbers relate to 5.x-1.x-dev release of the TinyMCE module):

Line 494 change:

$host = $base_url;

to your site's domain name:

$host = "http://www.yoursite.com/";

Between lines 505-506

$init['relative_urls'] = 'false';
$init['document_base_url'] = "$host";

add the following extra parameter:

$init['relative_urls'] = 'false';
$init['remove_script_host'] = 'false';
$init['document_base_url'] = "$host";

These settings are taken from the TinyMCE FAQ on the subject. Once you have made these changes you should find TinyMCE behaves itself much better when it comes to using FeedBurner.