Forum Moderators: phranque

Message Too Old, No Replies

Need a quick review of Rewriterule with QUERY STRING

I have the code ready - (no spoon feeding :)

         

vince786

6:44 pm on Feb 15, 2011 (gmt 0)

10+ Year Member



Hello All!

I think I now understand the basics of mod_rewrite and I just completed the following rule:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^.*/shop/index\.php\ HTTP/ [NC]
RewriteCond %{SERVER_PORT} ^8080$
RewriteCond %{QUERY_STRING} ^name=abc$
RewriteRule ^.*index\.php$ h2tp://newexample.com:10080/shop/index.php?name=abc [R=301,L]

So what I am doing is:
1) Check THE_REQUEST - does it contain uri like /shop/index.jsp HTTP
2) Is the port 8080
3) Does it contain a query string ?name=abc
4) Does the uri contain /index.php

If all above YES then the url will be as above.

Couple of questions:
1) Since my app goes through Siteminder I am not able to interpret the behaviour right away since there is authetication required first
2) In the RewriteRule line, does Apache automatically append the query String or should one write the new url the way I have.

Would greatly appreciate feedback.

Thanks,

vince

jdMorgan

11:51 pm on Feb 17, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please see [webmasterworld.com...]

Jim