WordPress: Getting WP Super Cache to Work With WordPress PDA & iPhone

WordPress: Getting WP Super Cache to Work With WordPress PDA & iPhone

I struggled with getting WP Super Cache in full caching mode to work with a mobile device plugin such as WordPress PDA & iPhone for a long time. Awhile back I actually had given up because everything I was doing appeared that it should work but it wasn’t working properly. Needless to say I recently moved the site to a new server and decided to give it another shot. This time I was able to get WP Super Cache working with WordPress PDA and iPhone with ease.

Please realize that this method makes it so all of the mobile browsers do not cache¬†pages but they also do not retrieve pages from the cache. To configure the below properly you have to realize that there are two different things happening which are the fact that mobile browsers should not cache files and they should not read from the cache. Basically if they didn’t cache files but read from the cache they would be reading the cache of the default template that you see in IE. If mobile browsers cached files then they would be caching the mobile template so when typical browsers such as Internet Explorer or Firefox visited the same pages they would be viewing the mobile cache instead of the default template you have configure.

Enable WordPress PDA & iPhone w/Super Cache Enabled:

  1. Install WP Super Cache:First install WP Super Cache and verify that it is working with your site before enabling any type of mobile template plugin.
  2. Install WordPress PDA & iPhone:Now install the WordPress PDA & iPhone plugin but do not activate it just yet. There are a couple of other steps we need to complete before activating this plugin.
  3. Modify WP Super Cache Config:Now in the WP admin we want to modify a setting for WP Super Cache. In the WP Super Cache admin paste the below into the ‘Rejected User Agents” configuration box. Make sure that there is only one item on each like and remove the comas. The below list is simply to make it easy to copy/paste to a notepad and then modify to the correct format. Something else to note is that User Agents with spaces such as “Opera Mini” require a backslash. Once you enter “Opera\ Mini” on a line and save it will become two lines but that is ok as long as Opera\ is on one line and Mini is on the other.

    1. iPod, Palm, EudoraWeb, Blazer, AvantGo, Windows\ CE, Cellphone, Small, MMEF20, Danger, hiptop, Proxinet, ProxiNet, Newt, PalmOS, NetFront, SHARP-TQ-GX10, SonyEricsson, SymbianOS, UP.Browser, UP.Link, TS21i-10, MOT-V, portalmmm, DoCoMo, Opera\ Mini, Palm, Handspring, Nokia, Kyocera, Samsung, Motorola, Mot, iPhone, Smartphone, Blackberry, WAP, SonyEricsson, PlayStation\ Portable, LG, MMP, OPWV, Symbian, EPOC
  4. Modify .htaccess:Now you need to modify the .htaccess file located in the root directory of your WordPress installation. Add the below line right after “RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$” which occurs twice. Also make sure to back up your .htaccess file before making any changes to it. If you accidently mess something up you want to be able to switch back to a working copy immediately.

    1. RewriteCond %{HTTP_USER_AGENT} !^.*(Opera\ Mini|iPhone|Blackberry|Palm|EudoraWeb|Blazer|AvantGo|Windows\ CE|Cellphone|Small|MMEF20|Danger|hiptop|Proxinet|ProxiNet|Newt|PalmOS|NetFront|SHARP-TQ-GX10|SonyEricsson|SymbianOS|UP.BrowserUP.Link|TS21i-10|MOT-V|portalmmm|DoCoMo|Handspring|Nokia|Kyocera|Samsung|Motorola|Mot|Smartphone|WAP|SonyEricsson|PlayStation\ Portable|LG|MMP|OPWV|Symbian|EPOC) [NC]

    After you make the .htaccess file modification make sure to test that your site is operational both from a normal browser and from a mobile browser if available.

  5. Activate WordPress PDA & iPhone:now click on the Installed link underneath Plugins in the left hand navigation in your WordPress administration site. Click the Activate link in the Actions column on the right side of the WordPress PDA and iPhone plugin on this page.
  6. Verify Functionality: I recommend testing this in numerous ways to make 100% sure everything is functioning properly because if there is an issue its not going to be easy to track down. So make sure to test the same pages with non-mobile browsers and with mobile browsers to make sure that either type of browser is not seeing the template meant for the other.

Having mobile templates is a great addition to any WordPress site. If you start doing a decent amount of traffic WP Super Cache is really beneficial so your blog doesn’t slow to a crawl. Getting these two plugins to play nicely together is a huge benefit for your blog.

WordPress Theme Design: A Complete Guide to Creating Professional WordPress Themes (Paperback)

List Price: $39.99 USD
New From: $3.99 USD In Stock
Used from: $0.01 USD In Stock

Building a WordPress Blog People Want to Read (Paperback)

List Price: $29.99
New From: $2.95 USD In Stock
Used from: $0.01 USD In Stock