main website home
  • About this blog

    This blog features updates, opinions, and technical notes from Caucho engineers about Caucho products, the enterprise Java industry, and PHP. Caucho Technology is the creator of the Resin Application Server and the Quercus PHP in Java engine. A leader in Java performance since 1998, Caucho is a Sun JavaEE licensee with over 9000 customers worldwide.
  • Tags

    ajaxworld bam candi cdi cloud cluster comet configuration deploy devoxx eclipse ejb embedded flash flex google app engine hessian hmtp ioc java ee 6 javaone javazone jms messaging newsletter nyjug osgi php pomegranate quercus resin resin 4.0 REST servlet sfjug silicon valley code camp spring testing training tssjs watchdog webbeans web profile websockets wordpress
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
« Quercus on the Google App Engine
Resin 4.0.0 Release »

Quick tip: Rewrite Rules for WordPress

We use WordPress for this blog and I recently upgraded to the 2.7.1 version. The developers have started using a .htaccess file with Apache mod_rewrite rules, so we need to emulate that to support certain things like permalinks. This is a quick and trivial example, but it gives a glimpse at our new rewrite dispatch syntax in Resin 4.

WordPress .htaccess Translated into Resin 4 rewrite dispatch
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
<web-app xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin">

  <resin:Dispatch>
    <resin:IfFileExists/>
  </resin:Dispatch>

  <resin:Forward regexp="^" target='/index.php'/>
</web-app>

I find our syntax to be far more readable and understandable than mod_rewrite, though that’s not hard. :-) Notice that the rules don’t have to be enclosed in <rewrite-dispatch> tag as in 3.1 — they’re first class members in the configuration. In case you have old rewrite dispatch rules from 3.1, Resin 4 does still understand them for backwards compatibility.

Tags: quercus, resin 4.0, wordpress

This entry was posted on Monday, May 4th, 2009 at 1:51 pm and is filed under Engineering. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Responses to “Quick tip: Rewrite Rules for WordPress”

  1. Steveorevo Says:
    November 16th, 2009 at 5:17 am

    Excellent! I was wondering if permalinks was possible. Unfortunately, looks like GD is broken in 4.0? WordPress’s insert photo features won’t enable thumbnail, medium, large sizes -possibly because they rely on GD functions. It appears that a simple GD text to image render PHP script crashes on 4.01, but was okay on 3.1. Outside of that, WP on Resin is looking really good!

  2. Emil Says:
    November 16th, 2009 at 4:38 pm

    Hi Steveorevo,

    Permalinks should work fine. Actually, caucho.com runs on WordPress and uses permalinks for the navigation.

    Do you have an example of GD functions failing? This blog runs on WP and Quercus and I’m able to post images just fine.

    Thanks,
    Emil

Leave a Reply

You must be logged in to post a comment.


Caucho Technology is proudly powered by WordPress and Quercus®
Entries (RSS) and Comments (RSS).

  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • BLOG |
  • WIKI 4 |
  • WIKI 3 |
  • Resin: Java Application Server
Copyright (c) 1998-2012 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.
resin® is a cloud optimized, java® application server that supports the java ee webprofile ®