You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Greg <gr...@textor.com> on 2004/01/08 13:42:24 UTC

[users@httpd] Redirection trick with querystrings

Hi,

This may be a tricky one...I'm trying to use either RewriteEngine/Rewrite or
RedirectMatch (whatever works) to do the following:

When a URL of the form

http://myserver.com/scripts/redir.pl?a/index.html

arrives, I want the output to be

http://myserver.com/a/index.html



There's a small mixup with the 'scripts' in the path, but I've solved it and
it's not
related to my problem. The problem: As you can see, I want to 'capture' the
querystring and make it part of the output URL. (Yes, I want to get rid of
the script, the site will run statically) Is this possible? Do either
RewriteXXX or RedirectMatch support
something like that, separating the querystring and enable me to use them as
just
strings to be attached?

For example, when I use

RewriteRule redir\.pl?(.*) http://myserver.com/$1

I get

http://myserver.com/?g/index.htm

which means the querystring has been picked up as querystring and the
questionmark is still there. Now, the only thing I want is to get rid of
that questionmark, so the URL would be

http://myserver.com/g/index.htm


Any ideas? Is this possible?

Thanks in advance,
Greg




------------------------------------------
Greg Dimitriadis
Textor Webmasters
Tel: +44 20 8400 9362
Fax: +44 20 8742 0010




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


AW: [users@httpd] Redirection trick with querystrings

Posted by SH Solutions <in...@sh-solutions.de>.
Hi

> For example, when I use
> RewriteRule redir\.pl?(.*) http://myserver.com/$1
> I get
> http://myserver.com/?g/index.htm

The ? is interpreted as part of the reg exp. Try

> RewriteRule redir\.pl\?(.*) http://myserver.com/$1

cu,
  Steffen


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org