Search code examples
url-rewritingckeditorcakephp-2.0

Path to CKEditor in CakePHP app on Zeus server


I'm integrating CKEditor into a CakePHP app which is running on a Zeus server (and therefore can't use .htaccess - I have to use rewrite.script instead). Problem is, the paths that CKEditor puts into the head section of the page don't work, so the editor won't load.

For instance, one generated path is:

http://www.example.com/js/ckeditor/config.js?t=B8DJ5M3

If I go to

http://www.example.com/js/ckeditor/config.js

I can see the file, but as soon as I add the ?t=B8DJ5M3 on the end, Cake complains that it can't find the jsController.

I'm not sure what to do about this - whether to dig around in CakePHP, CKEditor or the rewrite.script files! What should I try next?


Solution

  • That query string on the end of your URL is used to make sure the file isn't cached. Seems like something in your GET request configuration/routing on the Zeus server is trying to locate that exact file including the query string. You're going to need to create a Rewrite that performs a goto on the URL minus the query string. I found a pretty solid article in the Drupal forums where someone put together a script that may help you: http://drupal.org/node/46508

    RULE_0_START:
    # get the document root
    map path into SCRATCH:DOCROOT from /
    # initialize our variables
    set SCRATCH:ORIG_URL = %{URL}
    set SCRATCH:REQUEST_URI = %{URL}
    
    # see if theres any queries in our URL
    match URL into $ with ^(.*)\?(.*)$
    if matched then
      set SCRATCH:REQUEST_URI = $1
      set SCRATCH:QUERY_STRING = $2
    endif
    RULE_0_END:
    

    And from there, handle your goto minus the query string. Hope that helps