views:

79

answers:

1

I have the latest Wordpress running on Tomcat 6.0.26 virtual host with Quercus PHP servlet.

It works, except when I try to use perm links. A url such as /index.php/my-page-name doesn't seem to ever hit the PHP servlet . It gets a browser error that request resource is not available. It's like it isn't matching the servlet urlmapping.

I'm using a standard method in the web.xml

<servlet-mapping>
    <servlet-name>Quercus Servlet</servlet-name>
    <url-pattern>*.php</url-pattern>
</servlet-mapping>

I see nothing showing up either in the Tomcat logs when I use the above URL.

Any ideas please?

A: 

This mapping indeed doesn't work well with pathinfo's.

You have 2 options:

  1. Replace suffix-mapping by a prefix-mapping. Put PHP files in a folder, e.g. /php and use /php/* instead of *.php.

  2. Create a Filter which dispatches the request to the desired Servlet when the request URI matches the *.php/* pattern as well.

BalusC
Thanks Balus,I spent some time after your suggestion playing with it. Finally it works with <servlet-mapping> <servlet-name>Quercus Servlet</servlet-name> <url-pattern>*.php</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Quercus Servlet</servlet-name> <url-pattern>/index.php/*</url-pattern> </servlet-mapping>With both of them I was able to get the specific problem working for Wordpress.It didn't like the *.php/*. It complained.
Andrew
That's also another way, but you're restricted to `index.php` only. For all other PHP files you have to add another mapping. Or did you have only one? If that fact was known, I'd have suggested as well to add just another mapping :) By the way, with the new mapping, the `*.php` is in fact superfluous.
BalusC