使用 Quercus 重写 Glassfish 上的 URL PHP
我有 Glassfish 3 服务器,并添加了 Quercus 4.0.7 以便能够在其上运行 PHP 应用程序。一切都与它完美配合。现在我尝试在我的服务器上运行 Question2Answer 应用程序。我能够打开应用程序,但它不允许我从一个页面导航到另一个页面,因为他们正在使用 .htaccess 文件重写 URL。我想知道在这种情况下我们如何重写 URL?
以下是 Question2Answer 的 .htaccess 内容:
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]
您对此有什么解决方案吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Tuckey 的
UrlRewriteFilter
(其灵感来自 mod_rewrite 并提供类似的功能)来实现重写规则。基本上,您必须:WEB-INF/lib
中,并将urlrewrite.xml
放入WEB-INF
中)。web.xml
中声明过滤器(请参阅安装说明)。urlrewrite.xml
文件中。帖子 Drupal on Glassfish with clean urls using Url Rewrite Filter 讨论了这种方法。根据您的需求进行调整。
Use Tuckey's
UrlRewriteFilter
(which is inspired by mod_rewrite and offers similar functionalities) to implement the rewrite rules. Basically, you'll have to:WEB-INF/lib
and theurlrewrite.xml
underWEB-INF
).web.xml
(see the install instructions).urlrewrite.xml
file.The post Drupal on Glassfish with clean urls using Url Rewrite Filter discusses this approach. Adapt it to your needs.