WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: W3 Total Cache] CDN url replacement stops working (34 posts)

  1. antosha
    Member
    Posted 3 years ago #

    Hi,
    First of all, I would like to thank the developers for the great plugin. I am fairly new to WordPress and I was at first disappointed with it's performance compared to other CMS's I am used to, until I found this plugin.

    However , I have a problem getting W3 Total Cache to work with Amazon S3.
    I have set up the CNAME settings correctly, uploaded the theme, wp-includes and minimify files and the plugin successfully replaced all the URI of theses files to my subdomain that I created for s3 (s3.mywebsitename.com).
    Two days later, I comeback to visit my website with my browser and surprise: the files are no longer pointing to s3.mywebsitename.com but to mywebsitename.com.
    I tried disable / re-enable CDN settings in W3 Total Cache and clear the cache, no luck. Then I decided to remove the plugin and re-install it, that did the job and the files addresses point to s3.mywebsitename.com.

    Two days after that, I comeback again and the same story again, my files point to my main domain instead of my s3 subdomain.

    What is the problem, how to fix this?

    I am running WordPress 3.0.3 on 1and1 shared hosting and using Amazon S3.

    Thanks
    Happy Holidays!

  2. craftsyr
    Member
    Posted 3 years ago #

    I am actually having the same issue, on both a VPS and a dedicated server. Any help is appreciated.

  3. xsquared_uk
    Member
    Posted 3 years ago #

    May or may not be related - I'm also on 3.0.3 and using S3, mine has uploaded all of the theme files to Amazon but never replaces the URL for them when you load the page.

    For example, if you view the background image it is still shown as http://www.mysite.com/image.png instead of static.mysite.com/image.png - however, the images in the posts are on the CDN. If you manually change the URL in the address bar from www to static then the file is there. Clearing the cache etc does nothing.

    Everything seems to work except possibly the URL replacement...?

  4. craftsyr
    Member
    Posted 3 years ago #

    Yes xsquared_uk your problem mirrors ours. I wonder does anyone have this issue in WordPress 2, or perhaps 3.0-3.0.2??

  5. Tom
    Member
    Posted 3 years ago #

    Is there a solution to this problem? I'm having the same issue, but on my site it switches back to point at my host within 20 min.

  6. Peter Murray
    Member
    Posted 3 years ago #

    [Posting this here as well because I noticed the other forum entry was marked as "Resolved".]

    Another data point -- the same thing happens to me. WordPress 3.0.4 with W3TC 0.9.1.3 and Amazon CloudFront. I don't have to reinstall the plugin; simply disabling/re-enabling gets W3TC to rewrite URLs to the CDN. Then at some point it stops rewriting URLs.

  7. western592
    Member
    Posted 3 years ago #

    Check to make sure your Unsuccessful file transfer queue is not full of errors. If this queue is full of errors, it may prevent some files from using the cdn.

  8. Frederick Townes
    Member
    Posted 3 years ago #

    @western592, this is the common cause of the problem. I recommend origin pull providers.

  9. Will
    Member
    Posted 3 years ago #

    I had similar problem where auto CDN urls worked and then checked back a couple of days later to find them not pointing to CDN.

    Solution: Deactivate and reactivate the plugin.

  10. C B
    Member
    Posted 3 years ago #

    The CDN urls are working for items that were part of the wp-includes and theme uploads, but not for the files contained in folders under Custom Files. The URLS are not being replaced to the CDN, they still point to the original domain.

    For instance, under Custom File I have an entry:

    /images/*

    To grab files from

    /images/a/img1.jpg
    /images/a/img2.jpg
    /images/B/img3.jpg
    /images/B/img1.jpg

    Everything is uploaded flawlessly to the cdn, but none of the URL are replace when I load the web page.
    I can access the image by direct URL as well.

    I have cleared the failed queue as well as deactivated activated the plugin.

    Any thoughts why the URL replacement is not working on Custom Files?

  11. sahaskatta
    Member
    Posted 3 years ago #

    This is a bug which has a very easy, but somewhat tedious fix.

    If you go back and check, you will notice that only new posts are not using the CDN urls. The older ones are probably working just fine.

    To solve the problem, I just go to the CDN section in the W3 Total Cache plugin. Select the "Unsuccessful file transfers" button. Then choose "delete queue" to solve the problem. You will probably have a list of files that the plugin thinks failed to upload, but they worked just fine.

    Just a small glitch, but you have to repeat that process from time to time.

  12. Eric Murphy
    Member
    Posted 3 years ago #

    This is how I "fixed" it:

    I went to
    --> Performance --> "CDN settings"
    --> button "unsuccessful file transfers"
    --> Delete queue

    and then uploaded the files again (which of course results in "file already exists messages")
    --> Performance --> "CDN settings"
    --> button "Upload custom files"

  13. C B
    Member
    Posted 3 years ago #

    I tried both suggestions. But I still have no URL replacement for those Custom Files, and the "unsuccessful file transfers" queue is empty.

    Could it be related to the fact that these directories are *outside* of the wordpress installation folder?

  14. Fahd Murtaza
    Member
    Posted 3 years ago #

    @ C B: Did you Deploy?

    If you're on Preview-mode, test your site after 'Deploy' and change configuration if needed.

  15. C B
    Member
    Posted 3 years ago #

    Thanks fahdi, but I had deployed already. I actually went back to Preview, re-uploaded the custom files and re-deployed. But I still have no URL replacement for those custom files. Other than the custom files, everything seems to be working great.

  16. Fahd Murtaza
    Member
    Posted 3 years ago #

    Hi C B

    Can you give an example of your URL structure for the custom files?

    I think I have an easy solution for you. If you can share your URL and the custom file URL.

    Regards,
    Fahd Murtaza

  17. C B
    Member
    Posted 3 years ago #

    The hostnames are faked, but the structure is what I'm hoping to accomplish.

    http://www.domain.com/includes/files/small/1245863_barriers.jpg
    replaced with
    http://x832.r3213.cf98912.rackcdn.com/includes/files/small/1245863_barriers.jpg

    I have verified that the rackcdn file exists and can be seen by using the direct URL, indicating the plugin successfully uploaded the Custom File directory to the cdn.

    In the Custom Files page, I specified.

    /includes/* to grab all the file and subdirectories below it.

    thanks, an easy solution would be great.

  18. Fahd Murtaza
    Member
    Posted 3 years ago #

    OK

    and the links to files in /includes/ directory are within the content of wordpress pages or posts?

    Or they are separately linked somewhere else?

  19. Fahd Murtaza
    Member
    Posted 3 years ago #

    BTW, while I wait for your answer, here is something that might help you.

    http://wordpress.org/extend/plugins/ossdl-cdn-off-linker/

    Replaces the blog URL by another for all files under wp-content and wp-includes. That way static content can be handled by a CDN by origin pull. (The origin is your blog address.)

    You could upload your static files to S3, CloudFront or just any site, too. For S3/Cloudfront, see this script to help you with uploading/synchronizing your blog files.

  20. C B
    Member
    Posted 3 years ago #

    Correct, I have wordpress pages/posts with <img> tags to content in the /includes/ directory. I was trying to avoid clogging up the Media LIbrary.

    Also, in case it matters, the /includes/ directory is at the same level as the wordpress directory.

    I'll check that plugin as well.

    /includes/
    /wordpress/wp-content/

  21. Fahd Murtaza
    Member
    Posted 3 years ago #

    yeah that plugin should do the trick for you.

  22. C B
    Member
    Posted 3 years ago #

    Ah, just realized, that other plugin is looking for content inside wp-content and wp-includes. My folder /includes/ is outside of the those directories. I'll need to consider relocating some directories potentially.

  23. Fahd Murtaza
    Member
    Posted 3 years ago #

    Not needed, you can simply change the values within the plugin and it should work.

    Or there is one simple way you can do this. Let me write a quick plugin for you.

  24. Fahd Murtaza
    Member
    Posted 3 years ago #

    http://urbangiraffe.com/plugins/sniplets/

    Simple dynamic search and replace.

  25. Fahd Murtaza
    Member
    Posted 3 years ago #

    You can try this plugin too

    http://wordpress.org/extend/plugins/real-time-find-and-replace/

    or simply use my quick and dirty code below

    add_filter('the_content', 'replace_links');

    and add it to your functions.php file within theme.

    Now you can use str_replace() in the repalcelinks() function to change your urls dynamically.

    function replace_links($content) {
    return str_replace("http://www.domain.com/includes/", "http://x832.r3213.cf98912.rackcdn.com/includes/", $content);
    }
  26. Frederick Townes
    Member
    Posted 3 years ago #

    If anyone is still having this issue with recent releases, please let me know.

  27. coltonfisher
    Member
    Posted 2 years ago #

    I am still having the same issue with the current release. Just set it up this morning, still cant seem to get it working.

  28. dzinga1
    Member
    Posted 2 years ago #

    same here...the plugin just stopped serving static content suddenly. One member suggested the following, but I cannot find these options in my plugin that I just upgraded

    --> Performance --> "CDN settings"
    --> button "unsuccessful file transfers"
    --> Delete queue
    and then uploaded the files again (which of course results in "file already exists messages")
    --> Performance --> "CDN settings"
    --> button "Upload custom files""

    Has anyone managed to fix this bug? Thank you

  29. Frederick Townes
    Member
    Posted 2 years ago #

    Can either of you (@dzinga1 / @coltonfisher) submit a bug submission form from the support tab of the plugin to simplify troubleshooting?

  30. dzinga1
    Member
    Posted 2 years ago #

    I submitted the bug report weeks ago, but got no reply :(

Topic Closed

This topic has been closed to new replies.

About this Topic