Rewrite Help

Discussion in 'Apache' started by kamal_anand, Jul 31, 2007.

  1. #1
    Hi,

    It would be really helpful for me if u could suggest me some solution,

    we have two webservers configured under a VIP(www.domain.com) , where i am including follwing rules in the .htaccess file of both the servers,
    so as to rewrite the url www.domain.com/param1/param2?param3=param4 to www.domain.com, but my application accepts only url of the format www.domain.com/param1/param2?param3=param4.


    RewriteCond %{QUERY_STRING} ^param3=param4&
    RewriteRule ^/param1/param2$ http://www.domain.com [R=301]

    RewriteCond %{HTTP_HOST} http://www.domain.com
    RewriteRule ^/([^/.]*)$ http://%{HTTP_HOST}/param1/param2?param3=param4 [PT]

    so it does redirects to www.domain.com, but the second rule is not working. i am bit confused in this case, why the second rule is not working eventhough the same worked in the test machine where we have only webserver which is configured to accept the rewrited request from the same websever.

    Thanks in advance,
    Kamal anand.
     
    kamal_anand, Jul 31, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    RewriteCond %{QUERY_STRING} ^param3=param4&
    RewriteRule ^/param1/param2$ http://www.domain.com [R=301]
    
    RewriteCond %{HTTP_HOST} ^www.domain.com
    RewriteRule ^/([^/.]*)$ http://%{HTTP_HOST}/param1/param2?param3=param4 [PT]
    Code (markup):
     
    krt, Aug 1, 2007 IP