url-rewritingglassfishquercusquestion2answer

Rewrite URL on Glassfish with Quercus' PHP


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?


Solution

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

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