Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

puzzled with redirect

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Apache+Tomcat+Cocoon  
Author Message
r_buecheler

External


Since: Jun 26, 2003
Posts: 17



(Msg. 1) Posted: Fri Jun 27, 2003 1:19 am
Post subject: puzzled with redirect
Archived from groups: alt>apache>configuration (more info?)

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

 >> Stay informed about: puzzled with redirect 
Back to top
Login to vote
greid

External


Since: Jun 27, 2003
Posts: 5



(Msg. 2) Posted: Fri Jun 27, 2003 1:52 pm
Post subject: Re: puzzled with redirect [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Robi" <r_buecheler.DeleteThis@remove.yahoo.com> wrote in message
news:vfne01t5f1bjac@corp.supernews.com...
 > I want to redirect everyting that goes to
<font color=purple> > <a style='text-decoration: underline;' href="http://myweb.TLD/foo/bar/</font" target="_blank">http://myweb.TLD/foo/bar/</font</a>>
 > to
<font color=purple> > <a style='text-decoration: underline;' href="http://otherweb.TLD/foobar/index.php?page=getfirstpage</font" target="_blank">http://otherweb.TLD/foobar/index.php?page=getfirstpage</font</a>>
 >
 > 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
<a style='text-decoration: underline;' href="http://otherweb.TLD/foobar/index.php?page=getfirstpage" target="_blank">http://otherweb.TLD/foobar/index.php?page=getfirstpage</a>
 > adds index.html at the end to getfirstpage (getfirstpageindex.html), and
 > Redirect permanent /foo/bar/index.html
<a style='text-decoration: underline;' href="http://otherweb.TLD/foobar/index.php?page=getfirstpage" target="_blank">http://otherweb.TLD/foobar/index.php?page=getfirstpage</a>
 > 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/
<a style='text-decoration: underline;' href="http://otherweb.TLD/foobar/index.php?page=getfirstpage" target="_blank">http://otherweb.TLD/foobar/index.php?page=getfirstpage</a>
^ don't forget this last slash

That should do what you want.

Gabriel<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: puzzled with redirect 
Back to top
Login to vote
r_buecheler

External


Since: Jun 26, 2003
Posts: 17



(Msg. 3) Posted: Fri Jun 27, 2003 1:52 pm
Post subject: Re: puzzled with redirect [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Gabriel Reid wrote:
 > Robi wrote:
  >> I want to redirect everyting that goes to
<font color=green>  >> <a style='text-decoration: underline;' href="http://myweb.TLD/foo/bar/</font" target="_blank">http://myweb.TLD/foo/bar/</font</a>>
  >> to
<font color=green>  >> <a style='text-decoration: underline;' href="http://otherweb.TLD/foobar/index.php?page=getfirstpage</font" target="_blank">http://otherweb.TLD/foobar/index.php?page=getfirstpage</font</a>>
[...]
  >> Redirect permanent /foo/bar
<font color=green>  >> <a style='text-decoration: underline;' href="http://otherweb.TLD/foobar/index.php?page=getfirstpage</font" target="_blank">http://otherweb.TLD/foobar/index.php?page=getfirstpage</font</a>>
  >> adds index.html at the end to getfirstpage (getfirstpageindex.html), and
  >> Redirect permanent /foo/bar/index.html
<font color=green>  >> <a style='text-decoration: underline;' href="http://otherweb.TLD/foobar/index.php?page=getfirstpage</font" target="_blank">http://otherweb.TLD/foobar/index.php?page=getfirstpage</font</a>>
  >> only serves index.html.
[...]
 > 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/
<font color=purple> > <a style='text-decoration: underline;' href="http://otherweb.TLD/foobar/index.php?page=getfirstpage</font" target="_blank">http://otherweb.TLD/foobar/index.php?page=getfirstpage</font</a>>
 > ^ don't forget this last slash

Fantastic!

Thanks a lot!

After I saw your reply, I re-read the mod_alias documentation (redirect)
again. I don't know how I overlooked RedirectMatch. It was right there.

Your explanation and example helped me better understand it. Smile
Thanks.

--
Robi<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: puzzled with redirect 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]