How to Get Absolute Domain URLs with Tiny MCE

I was having tremendous problems with absolute and relative domain URLs on my site. It is is an enormous problem for RSS feeds. If your images are showing up on your site then you are probably having the same problem I was. There is an easy solution, however, that solution has been incredibly difficult to find. As with most Drupal troubleshooting issues, you have to search through pages and pages and then you have to hunt through the page that it is covered on in order to find a solution. It is very frustrating, so I figured that I would document the process and save everyone the trouble.

How to Switch TinyMCE from Relative URLS to Absolute URLs

You are going to need to edit a little code here. It can be done so from notepad if you need to, but if you have Dreamweaver, that is the program for it.

  1. Download your tinymce.module file from your site.

  2. Open it in Dreamweaver, or whatever code editor you use (notepad as a last resort)

  3. Change line 496 (this could be in a slightly different place depending on your version. If you can't find it here, it will be one or two lines above or below. You can always use the "find" function of your code editor.
    Change:
    $host = $base_url;

    To:
    $host = "http://www.yoursite.com/";
  4. Locate the code below, it should be around 505 and 506:
    Between these lines:
    $init['relative_urls'] = 'false';
    $init['document_base_url'] = "$host";

    Add:
    $init['remove_script_host'] = 'false';

    It Should Look Like This:
    $init['relative_urls'] = 'false';
    $init['remove_script_host'] = 'false';
    $init['document_base_url'] = "$host";

There you have it, Absolute URLs with TinyMCE and no headaches. Hopefully you found this page before you spent hours trying to mess around without actually fixing anything (like I did). If I save one person an hour of screwing around, it will have been worth it.

Post new comment

The content of this field is kept private and will not be shown publicly.