views:

22

answers:

1

I have Glassfish 3 server and have added Quercus 4.0.7 to to be able to run PHP applications on it. Everything works perfectly with it. Now I'm trying to run Question2Answer application on my server. I was able to open application but it's not allowing me to navigate from page to page because they are using .htaccess file to rewrite the URL. I was wondering how do we rewrite the URL in this case?

Here is what Question2Answer's .htaccess has inside:

DirectoryIndex index.php
RewriteEngine On
#RewriteBase /your-sub-directory
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]

Do you have any solutions for that?

+1  A: 

Use Tuckey's UrlRewriteFilter (which is inspired by mod_rewrite and offers similar functionalities) to implement the rewrite rules. Basically, you'll have to:

  • Get Quercus's war and unpack it
  • Download the filter and unpack it inside Quercus (this will put the filter jar inside WEB-INF/lib and the urlrewrite.xml under WEB-INF).
  • Declare the filter in the web.xml (see the install instructions).
  • "Port" your rewrite rules to the urlrewrite.xml file.
  • Repackage and deploy the war (or deploy it as an exploded archive).

The post Drupal on Glassfish with clean urls using Url Rewrite Filter discusses this approach. Adapt it to your needs.

Pascal Thivent