Forum Moderators: phranque
This would be the original url.
http://www.foobar.com/ev.php?URL_ID=1527&URL_DO=DO_TOPIC&URL_SECTION=201&reload=1047330420
and I would like to change it to
http://www.foobar.com/minga
here is the code that I am using for modrewrite
#Used to rewrite url when clicking on a link
RewriteCond %{QUERY_STRING} URL_ID=1527&URL_DO=DO_TOPIC&URL_SECTION=201*
RewriteCond %{THE_REQUEST}!minga
RewriteRule ^(.*) /minga [R,L]
#Rewrite rule redirecting link.
RewriteRule ^minga/ /minga [R,L]
RewriteRule ^minga /ev.php?URL_ID=1527&URL_DO=DO_TOPIC&URL_SECTION=201 [PT,L,NC]
Now with this I get the following url:
http://foobar.com/minga?URL_ID=1527&URL_DO=DO_TOPIC&URL_SECTION=201&reload=1047330420
Anyone have any ideas on how to remove the query string from the url?
First, it looks like to me that the code is backwards? Don't you really want to be doing something like:
[foobar.com...]
and results in a call to your sql query string?
I can't see why, you would want to go the other way. For example, look at the url, that is process by something like:
RewriteRule ^forum([0-9]+)/([0-9\-]+)\.htm(.*) read.cgi?forum=$1&discussion=$2$3 [T=application/x-httpd-cgi]
Which xlates the static url into a cgi call.
Isn't that what you are after? (If not - I am missing the point).
Msg4 [webmasterworld.com] explains about an easy solution to getting rid of those query strings [webmasterworld.com].
Andreas
I figured out how to remove the query string in the url by putting a? at the end of the rewrite rule. So now all is working perfectly. Here is the code.
RewriteCond %{QUERY_STRING} URL_ID=1527&URL_DO=DO_TOPIC&URL_SECTION=201*
RewriteCond %{THE_REQUEST}!minga
# the? at the end of the line removes the query string.
RewriteRule ^(.*) /minga? [R,L]
RewriteRule ^minga/ /minga [R,L]
RewriteRule ^minga /ev.php?URL_ID=1527&URL_DO=DO_TOPIC&URL_SECTION=201 [PT,L,NC]
Thanks again.