StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 04-03-2012, 09:02 AM
jp2112's Avatar
jp2112 jp2112 is offline
Registered User
Genesis Member
 
Join Date: Sep 2011
Location: NYC
Posts: 492
Default

Personally if I knew this was something that I needed on a long-term basis I would do this in .htaccess rather than using a Genesis or WP hook. In theory it should be much faster at the server level.

You could put something like this into your .htaccess file:

Code:
RewriteEngine On
RewriteRule ^wp-content/uploads/(.*)$ http://cdn.olicity.com/wp-content/uploads/$1
This would rewrite any request for a file in your local wp-content/uploads folder to the corresponding CDN folder. Tested with http://htaccess.madewithlove.be/

If you only wanted to pull specific files from your CDN, you could do something like this:

Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} (.*)\.css$ [NC]
RewriteRule ^(.*)$ http://cdn.olicity.com/$1
For example, you could set up a directory tree that mirrored your WP setup and copy only the .css files to those folders. The .css files would come from your CDN while the other files would still be served from your local WP install.
__________________
When asking for help, kindly:
1) Read the FAQ.
2) Post your URL.
3) Use [php][/php] tags when posting programming code,
or [html][/html] when posting website source code.
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add 2nd Subnav Bar - Conditionally? angiemel General Discussion 2 05-21-2010 07:27 PM


All times are GMT -5. The time now is 07:10 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.