开发者

Apache web server mod_rewrite module RewriteRule problem

开发者 https://www.devze.com 2023-02-07 18:31 出处:网络
I have a Struts 2 application on Tomcat 6. There is a Apache 2.2 web server in front of Tomcat. I am trying to create Google friendly URLs by mod_rewrite.

I have a Struts 2 application on Tomcat 6. There is a Apache 2.2 web server in front of Tomcat. I am trying to create Google friendly URLs by mod_rewrite.

What I am trying to do: When I request http://domainna开发者_如何学Cme/some-title, it must reach to Tomcat as http://domainname:8080/fetch.action?entry.title=some-title

I wrote a rule:

RewriteRule ^/(.*)  /fetch.action?entry.title=$1    [L]

But it doesnt work! Does anyone help me? Thanks.

My Apache virtual host configuration is:

<VirtualHost *:80>
    ServerName ihlsozluk
    RewriteEngine on
    RewriteRule     ^/(.*)  /fetch.action?entry.title=$1    [L]
    JkMount /* worker1
    ErrorLog logs/ihlsozluk-error.log
    CustomLog logs/ihlsozluk-access.log common
</VirtualHost>


You need to make an internal proxy request as the destination port 8080 is probably only internally reachable:

RewriteRule ^/(.*) http://%{HTTP_HOST}:8080/fetch.action?entry.title=$1 [L,P]
0

精彩评论

暂无评论...
验证码 换一张
取 消