redirecting to different hostname and dropping query string

redirecting to different hostname and dropping query string

Post by Rhett Dani » Tue, 21 May 2002 23:28:12



I have server with one ipaddress that has multiple host names, and
have only one SSL certificate registered to one of the hostnames.
When I receive a request for the domainname.com, without the www, I
want to redirect to the www.domainname.com and drop any URI or Query
String information.  I am currently using the rewrite engine to do
this, but thought there might be a better way.

Does anyone have any suggestions and/or examples?

thank you!

 
 
 

redirecting to different hostname and dropping query string

Post by Karl Ove Hufthamme » Wed, 22 May 2002 00:14:34



Quote:> I have server with one ipaddress that has multiple host names, and
> have only one SSL certificate registered to one of the hostnames.
> When I receive a request for the domainname.com, without the www, I
> want to redirect to the www.domainname.com and drop any URI or Query
> String information.  I am currently using the rewrite engine to do
> this, but thought there might be a better way.

Not that I'm aware of. But what's wrong with the rewrite engine?

--
Karl Ove Hufthammer

 
 
 

redirecting to different hostname and dropping query string

Post by Rhett Dani » Sat, 25 May 2002 03:59:45


Rewrite is working.  I was just concerned that it was more overhead
than using rewrite or rewritematch.

thanks,

-Rhett



> > I have server with one ipaddress that has multiple host names, and
> > have only one SSL certificate registered to one of the hostnames.
> > When I receive a request for the domainname.com, without the www, I
> > want to redirect to the www.domainname.com and drop any URI or Query
> > String information.  I am currently using the rewrite engine to do
> > this, but thought there might be a better way.

> Not that I'm aware of. But what's wrong with the rewrite engine?

 
 
 

1. using mod_rewrite to redirect based on query-string

Hi.

I'm having problems using mod_rewrite to catch the query_string in URLs and
redirecting based on it

First of all. The full URL the pages reside at is:

http://www.gathering.org/servlets/Web.WebServlet?page=0

After playing with mod_rewrite for a short time, I managed to get
http://www.gathering.org/TG99/?page=0 to show the same page, and also
/TG99/page0.html rewrites correctly.

Now, the problem is that the servlet that generates the pages will just add
it's query_string to the existing URL on all links it outputs, so when the
link "Contact information" points to /TG99/?page=1 if you access
/TG99/?page=0 everything works fine. However, if you access
/TG99/page0.html, the link "Contact information" will point to
/TG99/page0.html?page=1 and clicking this link will still show page 0.

I would like to get mod_rewrite to redirect any requests to /TG99/.*?page=n
to /TG99/pagen.html?rest-of-query_string, but I just can't seem to get to
the query_string.

I've tried a rewriterule like this:
RewriteRule \?page=([0-9]+) http://www.gathering.org/TG99/page$1.html [R]

but it does not catch anything.

If I use RewriteCond I get a bit closer
e.g.
RewriteCond %{QUERY_STRING} page=([0-9]+)
RewriteRule .* http://www.gathering.org/TG99/page%1.html
works, but  the query_string is still appended, so /TG99/?page=0 is
redirected to
/TG99/page0.html?page=0 thus generating a loop.

Unfortunately I can't just throw away the query_string either, because
/TG99/page=0&item=1 will show the first item connected with page 0. So I
really need to be able to manipulate the full URL with the attached
query_string.

I love to fiddle with this, so I don't need "The Complete Solution" (tm),
but a few pointers would make me very happy.

--
Trond Michelsen

2. FreeVeracity integrity-assessment network security tool.

3. Redirect a request based on the query string

4. using find without recursion

5. Is query-string passed to Pear script when redirected.

6. Zmodem ftp site?

7. Configuring apache for query strings to accept "domain.com/?query" when using index.cgi...

8. Nautilus being developed any more?

9. -m --string with 3 different strings

10. Different hostnames for different situations.

11. Different Hostnames For Different Network Interfaces?

12. ip_rt_advice: redirect to 192.168.1.4/00 dropped

13. hostnames instead of ip's in bind query log?