It worked!! Thanks a ton! Cheers -Vicky
On Thu, 24 Nov 2022, 18:51 Eric Covener, <cove...@gmail.com> wrote: > On Thu, Nov 24, 2022 at 8:09 AM vicky chb <vkych...@gmail.com> wrote: > > > > Hi, > > > > I am trying to achieve below redirection rule: > > http://localhost/?1234ab > > this url should be redirected to below url: > > http://localhost/welcome?trackFor=0&trackNo=1234ab > > (where welcome?trackFor=0trackNo= always remains same) > > > > Here you can see at the end, the query string is passed same as in > source url i.e. 1234ab > > > > I wrote the below Rewrite rule and condition: > > > > <IfModule mod_rewrite.c> > > RewriteEngine On > > RewriteCond %{QUERY_STRING} (.*(([0-9]+).*)) [NC] > > RewriteRule ^(.*)$ /welcome?trackFor=0&trackNo=%1 [L,R=302,QSD] > > </IfModule> > > > > When I hit the source URL in browser: http://localhost/?1234ab > > > > I receive, too many redirects error in browser and page keeps on loading. > > > > Am I missing something in mod_rewrite? > > The rule matches the target of the redirect, so it will loop. > If the rule is only valid for requests to "/?: > > If the rule is in virtual host context > RewriteRule ^/$ /welcome?trackFor=0&trackNo=%1 [L,R=302,QSD] > If the rule is in htaccess, location, or other sections: > RewriteRule ^$ /welcome?trackFor=0&trackNo=%1 [L,R=302,QSD] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org > For additional commands, e-mail: users-h...@httpd.apache.org > >