Forum Moderators: phranque

Message Too Old, No Replies

htaccess parameter questions

         

Alteczen

3:54 am on Dec 22, 2006 (gmt 0)

10+ Year Member



I have the following url

www.mysite.com/servlet/Detail?no=555

the I need redirected to:

www.mysite.com/detail.php?no=555

For the life of me I cannot get the htaccess file to parse the '?' character
Here is my rule:

RewriteRule ^/servlet/Detail.no=(.*) /detail.php?no=%1 [L]

What am I missing?

THANKS!

jdMorgan

4:12 am on Dec 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't need to handle the query string part at all if you're not changing it -- It will be passed through the RewriteRule unchanged by default.

If you do need to handle/change the query string, you must use a RewriteCond and reference the %{QUERY_STRING} variable.

The query string is not visible to RewriteRule, since it is not part of the URL, but rather, data attached to the request to be passed to the resource at that URL.

Note that the "?" serves only to delineate the URL from the query string, and will appear in neither the RewriteRule URL-path nor the %{QUERY_STRING} value.

See Note: Query String following the Apache mod_rewrite RewriteRule documentation [httpd.apache.org]

Jim