puzzled with redirect

This is a discussion on puzzled with redirect within the Apache Web Server forums, part of the Web Server and Related Forums category; I want to redirect everyting that goes to http://myweb.TLD/foo/bar/ to http://otherweb.TLD/foobar/index.php?...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-27-2003
Robi
 
Posts: n/a
Default puzzled with redirect

I want to redirect everyting that goes to
http://myweb.TLD/foo/bar/
to
http://otherweb.TLD/foobar/index.php?page=getfirstpage

what I mean is that no matter if they look for
/foo/bar/index.html or /foo/bar/subdir/blah.txt
they always get redirected to the same otherweb.TLD page.

Redirect permanent /foo/bar http://otherweb.TLD/foobar/index.php?page=getfirstpage
adds index.html at the end to getfirstpage (getfirstpageindex.html), and
Redirect permanent /foo/bar/index.html http://otherweb.TLD/foobar/index.php?page=getfirstpage
only serves index.html.

what possibilities do I have?


--
Robi
  #2 (permalink)  
Old 06-27-2003
Gabriel Reid
 
Posts: n/a
Default Re: puzzled with redirect


"Robi" <r_buecheler@remove.yahoo.com> wrote in message
news:vfne01t5f1bjac@corp.supernews.com...
> I want to redirect everyting that goes to
> http://myweb.TLD/foo/bar/
> to
> http://otherweb.TLD/foobar/index.php?page=getfirstpage
>
> what I mean is that no matter if they look for
> /foo/bar/index.html or /foo/bar/subdir/blah.txt
> they always get redirected to the same otherweb.TLD page.
>
> Redirect permanent /foo/bar

http://otherweb.TLD/foobar/index.php?page=getfirstpage
> adds index.html at the end to getfirstpage (getfirstpageindex.html), and
> Redirect permanent /foo/bar/index.html

http://otherweb.TLD/foobar/index.php?page=getfirstpage
> only serves index.html.
>
> what possibilities do I have?
>


First, an explanation of what is happening here. The idea of Redirect is to
redirect the request on the server and path that the incoming request had.
Therefore, it doesn't suit your purposes, because you want all requests,
regardless of their path (past /foo/bar) to go to one specific page.

If you first example, the server is giving the browser an initial redirect
to its own index.html page, then when the browser requests index.html, it
re-maps the index.html request onto the otherweb request and sends back the
redirect.

In the second example, the redirect will only work if you _specifically_
request index.html. Just requesting the directory won't work.

So, the solution: I would recommend using the RedirectMatch directive, as
follows:

RedirectMatch 301 /foo/bar/
http://otherweb.TLD/foobar/index.php?page=getfirstpage
^ don't forget this last slash

That should do what you want.

Gabriel


 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:04 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0