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?...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
"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 | |
|
|