I'm doing it with Rails since I'd eventually like to gather and
display information such as how many movies were redirected and what
categories or whatever were the most popular.

Anyway, I've got it working with:

match "/:category/:movie" => redirect("http://netflix.com/search?
category=%{category}&movie=%{movie}")

The only problems so far are if a category or movie has a space in it,
then I get an error "bad URI(is not URI?):" since it tries to go to
the site with a space still in the URL. How do I substitute spaces
inside symbols with something like a "+"? It has to be before it gets
redirected though. I'd like to be able to just type like netflixit.com/
dramatic comedy/heroes and it automatically turn the space into a "+"
right before it redirects, instead of manually typing the "+" in
netflixit.com/dramatic+comedy/heroes, which works correctly. So, I
guess before the URL a person types in gets to match
"/:category/:movie", it has to replace spaces with "+".

Thanks

On Dec 2, 7:28 am, Jan Marquardt <ja...@elsobrino.org> wrote:
> On 12/02/2010 04:00 PM, MOLTEN wrote:
>
> > Okay, I've been doing some looking around and it looks like using the
> > redirect helper is what I need. Does this look it would work?
>
> >    resources :movies
> >    match "/:category/:movie" =>  redirect("netflix.com/search?category=%
> > {category}&name=%{movie}")
>
> Why do you want to realize this with rails? As far as i can see, you can
> realize what you want to do with apache's mod_rewrite.
>
> Cheers,
>
> Jan
>
>
>
>
>
>
>
> > I don't exactly know what document to put this kind of code in though,
> > or in what context :(. The only point of the site would be to preform
> > that code though, like the site is extremely plain and basic. I don't
> > need statistics or anything (yet). A counter for the amount of
> > redirects would be nice though. How would I make a very basic app that
> > is just able to complete this code? There's a tiny part covering this
> > on railscasts.com, but he doesn't show making the actual app, just
> > using this little piece within it.
>
> > Thanks for taking the time to reply :)
>
> > On Dec 2, 6:07 am, MOLTEN<vincent.ciarav...@gmail.com>  wrote:
> >> It looks like you may not have seen the beginning of this post, let me
> >> just repost what may not have showed on ruby-forum.com:
>
> >> "Is it possible to make a site that only preforms a redirect to
> >> another
> >> site? Here's an example:
>
> >> Let's just say that a netflix.com URL to a movie is something like
> >> netflix.com/search?category=Fantasy&name=Heroes&blahtechnical-stuff"
>
> >> I kinda thought about that, but I think one of the main parts of the
> >> site I'm trying to do is that it converts and substitutes things from
> >> my site to something on the site I'm redirecting to. For example:
>
> >> In netflixit.com/fantasy/heroes...
> >> netflixit.com converts to netflix.com/search?
> >> /fantasy/ converts to category=Fantasy
> >> /heroes/ converts to&name=Heroes
>
> >> So what I need it to do is both redirect and transform some of the
> >> stuff. There will only and always be 2 sections, such /category/
> >> title/, so that may make it easier. If a user doesn't put the correct
> >> amount of sections, I'll just take them to the home page
> >> netflixit.com, or whatever.
>
> >> On Dec 2, 5:54 am, Robert Walker<li...@ruby-forum.com>  wrote:
>
> >>> MOLTEN wrote in post #965662:
>
> >>>> Could you make a really simple app in Rails at say the domain
> >>>> netflixit.com that allows people to just type in like netflixit.com/
> >>>> fantasy/heroes and be instantly directed to the netflix version? So, I
> >>>> guess it has to convert and change the URL, but I don't know how. The
> >>>> website would be pretty much blank. The only thing it would be used
> >>>> for is automatically redirecting to the netflix site. The idea is just
> >>>> to give people an easier way to find something in a database type site
> >>>> if they already know what they are looking for.
>
> >>>> This sounds like it would be very easy, but I'm still a beginner in
> >>>> Rails. I don't even know the correct term for what this would be
> >>>> called - might be easier to find information if I did :D
>
> >>>> So, does anyone know any tutorials that show how to do this, or at
> >>>> least know the technical term for this so I can do my own searching?
>
> >>> There are already many sites that do exactly this bit.ly, j.mp,
> >>> tinyurl.com, etc.
>
> >>> Yes, these sites do this for the express purpose of shortening the URL,
> >>> but what you're describing is really the same thing. Do a Google search
> >>> for URL shortening scripts and see how they work. That should get you
> >>> started.
>
> >>> --
> >>> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to