Im currently in the process of adding permalinking to my site; at the moment I am simply testing it out in development mode. The problem is that at the moment I have all of these URLs that lead to the same content: http://127.0.0.1:3000/categories/1-css/tutorials/12-test9 http://127.0.0.1:3000/tutorials/12-test9 http://127.0.0.1:3000/categories/1/tutorials/12 http://127.0.0.1:3000/tutorials/12 What I''m trying to acheive is to get all of these URLs to redirect to the top one so that google won''t think I''ve got duplicate content. Please Help, If you need any more information feel free to ask, Thanks In Advance, -Joe -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Bump?! Can anyone help with this? On 21 June, 17:11, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Im currently in the process of adding permalinking to my site; at the > moment I am simply testing it out in development mode. > > The problem is that at the moment I have all of these URLs that lead > to the same content: > > http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0.0.1:3000/tutorials/12-test9http://127.0.0.1:3000/categories/1/tutorials/12http://127.0.0.1:3000/tutorials/12 > > What I''m trying to acheive is to get all of these URLs to redirect to > the top one so that google won''t think I''ve got duplicate content. > > Please Help, > > If you need any more information feel free to ask, > > Thanks In Advance, > > -Joe-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Try gem rack-rewrite, that can solve your problem. Cheers, Lecky On Jun 23, 6:16 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Bump?! Can anyone help with this? > > On 21 June, 17:11, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Im currently in the process of adding permalinking to my site; at the > > moment I am simply testing it out in development mode. > > > The problem is that at the moment I have all of these URLs that lead > > to the same content: > > >http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0... > > > What I''m trying to acheive is to get all of these URLs to redirect to > > the top one so that google won''t think I''ve got duplicate content. > > > Please Help, > > > If you need any more information feel free to ask, > > > Thanks In Advance, > > > -Joe-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I see code like this used in examples: config.gem ''rack-rewrite'', ''~> 1.0.0'' require ''rack/rewrite'' config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do rewrite ''/wiki/John_Trupiano'', ''/john'' r301 ''/wiki/Yair_Flicker'', ''/yair'' r302 ''/wiki/Greg_Jastrab'', ''/greg'' r301 %r{/wiki/(\w+)_\w+}, ''/$1'' end Where does this code go? How can I make this apply to a whole group? For example instead of only making tutorials/61 go to the proper URL, making anything that is just "/tutorials/SOMETHING" go to the proper URL? Please Help, Thanks In Advance, -Joe On 23 June, 10:21, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try gem rack-rewrite, that can solve your problem. > > Cheers, > Lecky > > On Jun 23, 6:16 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Bump?! Can anyone help with this? > > > On 21 June, 17:11, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Im currently in the process of adding permalinking to my site; at the > > > moment I am simply testing it out in development mode. > > > > The problem is that at the moment I have all of these URLs that lead > > > to the same content: > > > >http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0... > > > > What I''m trying to acheive is to get all of these URLs to redirect to > > > the top one so that google won''t think I''ve got duplicate content. > > > > Please Help, > > > > If you need any more information feel free to ask, > > > > Thanks In Advance, > > > > -Joe-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I see code like this used in examples: config.gem ''rack-rewrite'', ''~> 1.0.0'' require ''rack/rewrite'' config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do rewrite ''/wiki/John_Trupiano'', ''/john'' r301 ''/wiki/Yair_Flicker'', ''/yair'' r302 ''/wiki/Greg_Jastrab'', ''/greg'' r301 %r{/wiki/(\w+)_\w+}, ''/$1'' end Where does this code go? How can I make this apply to a whole group? For example instead of only making tutorials/61 go to the proper URL, making anything that is just "/tutorials/SOMETHING" go to the proper URL? Please Help, Thanks In Advance, -Joe On 23 June, 10:21, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try gem rack-rewrite, that can solve your problem. > > Cheers, > Lecky > > On Jun 23, 6:16 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Bump?! Can anyone help with this? > > > On 21 June, 17:11, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Im currently in the process of adding permalinking to my site; at the > > > moment I am simply testing it out in development mode. > > > > The problem is that at the moment I have all of these URLs that lead > > > to the same content: > > > >http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0... > > > > What I''m trying to acheive is to get all of these URLs to redirect to > > > the top one so that google won''t think I''ve got duplicate content. > > > > Please Help, > > > > If you need any more information feel free to ask, > > > > Thanks In Advance, > > > > -Joe-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Joe, Firstly, this code goes in config/application.rb. Secondly, you can write regular expression like the example did to redirect your URLs. Cheers, Lecky On Jun 24, 2:51 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> I see code like this used in examples: > > config.gem ''rack-rewrite'', ''~> 1.0.0'' > require ''rack/rewrite'' > config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do > rewrite ''/wiki/John_Trupiano'', ''/john'' > r301 ''/wiki/Yair_Flicker'', ''/yair'' > r302 ''/wiki/Greg_Jastrab'', ''/greg'' > r301 %r{/wiki/(\w+)_\w+}, ''/$1'' > end > > Where does this code go? > > How can I make this apply to a whole group? For example instead of > only making tutorials/61 go to the proper URL, making anything that is > just "/tutorials/SOMETHING" go to the proper URL? > > Please Help, > > Thanks In Advance, > > -Joe > > On 23 June, 10:21, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Try gem rack-rewrite, that can solve your problem. > > > Cheers, > > Lecky > > > On Jun 23, 6:16 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Bump?! Can anyone help with this? > > > > On 21 June, 17:11, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > Im currently in the process of adding permalinking to my site; at the > > > > moment I am simply testing it out in development mode. > > > > > The problem is that at the moment I have all of these URLs that lead > > > > to the same content: > > > > >http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0... > > > > > What I''m trying to acheive is to get all of these URLs to redirect to > > > > the top one so that google won''t think I''ve got duplicate content. > > > > > Please Help, > > > > > If you need any more information feel free to ask, > > > > > Thanks In Advance, > > > > > -Joe-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
More problems.. Firstly I don''t have an application.rb file to add this into. Secondly, where does my example use a regular expression? and how can I do something similar with my RoR application? On 24 June, 11:55, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Joe, > > Firstly, this code goes in config/application.rb. Secondly, you can > write regular expression like the example did to redirect your URLs. > > Cheers, > Lecky > > On Jun 24, 2:51 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > I see code like this used in examples: > > > config.gem ''rack-rewrite'', ''~> 1.0.0'' > > require ''rack/rewrite'' > > config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do > > rewrite ''/wiki/John_Trupiano'', ''/john'' > > r301 ''/wiki/Yair_Flicker'', ''/yair'' > > r302 ''/wiki/Greg_Jastrab'', ''/greg'' > > r301 %r{/wiki/(\w+)_\w+}, ''/$1'' > > end > > > Where does this code go? > > > How can I make this apply to a whole group? For example instead of > > only making tutorials/61 go to the proper URL, making anything that is > > just "/tutorials/SOMETHING" go to the proper URL? > > > Please Help, > > > Thanks In Advance, > > > -Joe > > > On 23 June, 10:21, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Try gem rack-rewrite, that can solve your problem. > > > > Cheers, > > > Lecky > > > > On Jun 23, 6:16 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > Bump?! Can anyone help with this? > > > > > On 21 June, 17:11, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > Im currently in the process of adding permalinking to my site; at the > > > > > moment I am simply testing it out in development mode. > > > > > > The problem is that at the moment I have all of these URLs that lead > > > > > to the same content: > > > > > >http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0... > > > > > > What I''m trying to acheive is to get all of these URLs to redirect to > > > > > the top one so that google won''t think I''ve got duplicate content. > > > > > > Please Help, > > > > > > If you need any more information feel free to ask, > > > > > > Thanks In Advance, > > > > > > -Joe-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org
2010-Jun-25 18:58 UTC
Re: Redirecting old URLs to new permalinked URLs
Bump?! Please help. On 24 June, 15:21, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> More problems.. > > Firstly I don''t have an application.rb file to add this into. > > Secondly, where does my example use a regular expression? and how can > I do something similar with my RoR application? > > On 24 June, 11:55, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi Joe, > > > Firstly, this code goes in config/application.rb. Secondly, you can > > write regular expression like the example did to redirect your URLs. > > > Cheers, > > Lecky > > > On Jun 24, 2:51 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > I see code like this used in examples: > > > > config.gem ''rack-rewrite'', ''~> 1.0.0'' > > > require ''rack/rewrite'' > > > config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do > > > rewrite ''/wiki/John_Trupiano'', ''/john'' > > > r301 ''/wiki/Yair_Flicker'', ''/yair'' > > > r302 ''/wiki/Greg_Jastrab'', ''/greg'' > > > r301 %r{/wiki/(\w+)_\w+}, ''/$1'' > > > end > > > > Where does this code go? > > > > How can I make this apply to a whole group? For example instead of > > > only making tutorials/61 go to the proper URL, making anything that is > > > just "/tutorials/SOMETHING" go to the proper URL? > > > > Please Help, > > > > Thanks In Advance, > > > > -Joe > > > > On 23 June, 10:21, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Try gem rack-rewrite, that can solve your problem. > > > > > Cheers, > > > > Lecky > > > > > On Jun 23, 6:16 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > Bump?! Can anyone help with this? > > > > > > On 21 June, 17:11, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > Im currently in the process of adding permalinking to my site; at the > > > > > > moment I am simply testing it out in development mode. > > > > > > > The problem is that at the moment I have all of these URLs that lead > > > > > > to the same content: > > > > > > >http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0... > > > > > > > What I''m trying to acheive is to get all of these URLs to redirect to > > > > > > the top one so that google won''t think I''ve got duplicate content. > > > > > > > Please Help, > > > > > > > If you need any more information feel free to ask, > > > > > > > Thanks In Advance, > > > > > > > -Joe-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Bump?! Please Help On 25 June, 19:58, yout...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org wrote:> Bump?! Please help. > > On 24 June, 15:21, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > More problems.. > > > Firstly I don''t have an application.rb file to add this into. > > > Secondly, where does my example use a regular expression? and how can > > I do something similar with my RoR application? > > > On 24 June, 11:55, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi Joe, > > > > Firstly, this code goes in config/application.rb. Secondly, you can > > > write regular expression like the example did to redirect your URLs. > > > > Cheers, > > > Lecky > > > > On Jun 24, 2:51 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > I see code like this used in examples: > > > > > config.gem ''rack-rewrite'', ''~> 1.0.0'' > > > > require ''rack/rewrite'' > > > > config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do > > > > rewrite ''/wiki/John_Trupiano'', ''/john'' > > > > r301 ''/wiki/Yair_Flicker'', ''/yair'' > > > > r302 ''/wiki/Greg_Jastrab'', ''/greg'' > > > > r301 %r{/wiki/(\w+)_\w+}, ''/$1'' > > > > end > > > > > Where does this code go? > > > > > How can I make this apply to a whole group? For example instead of > > > > only making tutorials/61 go to the proper URL, making anything that is > > > > just "/tutorials/SOMETHING" go to the proper URL? > > > > > Please Help, > > > > > Thanks In Advance, > > > > > -Joe > > > > > On 23 June, 10:21, Lecky <lecky...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Try gem rack-rewrite, that can solve your problem. > > > > > > Cheers, > > > > > Lecky > > > > > > On Jun 23, 6:16 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > Bump?! Can anyone help with this? > > > > > > > On 21 June, 17:11, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > Im currently in the process of adding permalinking to my site; at the > > > > > > > moment I am simply testing it out in development mode. > > > > > > > > The problem is that at the moment I have all of these URLs that lead > > > > > > > to the same content: > > > > > > > >http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0... > > > > > > > > What I''m trying to acheive is to get all of these URLs to redirect to > > > > > > > the top one so that google won''t think I''ve got duplicate content. > > > > > > > > Please Help, > > > > > > > > If you need any more information feel free to ask, > > > > > > > > Thanks In Advance, > > > > > > > > -Joe-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Jun-26 20:10 UTC
Re: Re: Redirecting old URLs to new permalinked URLs
On Wed, Jun 23, 2010 at 9:51 AM, Joe <joe-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> I see code like this used in examples: > > config.gem ''rack-rewrite'', ''~> 1.0.0'' > require ''rack/rewrite'' > config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do > rewrite ''/wiki/John_Trupiano'', ''/john'' > r301 ''/wiki/Yair_Flicker'', ''/yair'' > r302 ''/wiki/Greg_Jastrab'', ''/greg'' > r301 %r{/wiki/(\w+)_\w+}, ''/$1'' > end> Where does this code go?Look at your app and see where you find ''config.gem'' entries. Or read about using Rack middleware. It should be pretty obvious :-)> How can I make this apply to a whole group?And you''ve already gotten that answer -- use a regular expression. If you don''t recognize that your own example includes one, you''re probably in deep bandini already :-) Good luck, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The environment files? I think thats where it would go. As for regular expressions, I don''t have a clue where it is in the example, Im really not amazingly good in RoR and I would very much appreciate some help with figuring it out.. Thanks In Advance, -Joe On 26 June, 21:10, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Wed, Jun 23, 2010 at 9:51 AM, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > I see code like this used in examples: > > > config.gem ''rack-rewrite'', ''~> 1.0.0'' > > require ''rack/rewrite'' > > config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do > > rewrite ''/wiki/John_Trupiano'', ''/john'' > > r301 ''/wiki/Yair_Flicker'', ''/yair'' > > r302 ''/wiki/Greg_Jastrab'', ''/greg'' > > r301 %r{/wiki/(\w+)_\w+}, ''/$1'' > > end > > Where does this code go? > > Look at your app and see where you find ''config.gem'' entries. Or > read about using Rack middleware. It should be pretty obvious :-) > > > How can I make this apply to a whole group? > > And you''ve already gotten that answer -- use a regular expression. > If you don''t recognize that your own example includes one, you''re > probably in deep bandini already :-) > > Good luck, > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Jun-27 18:02 UTC
Re: Re: Redirecting old URLs to new permalinked URLs
On Sun, Jun 27, 2010 at 10:45 AM, Joe <joe-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> The environment files? > > I think thats where it would go.So try it and see :-)> As for regular expressions, I don''t > have a clue where it is in the example, Im really not amazingly good > in RoRWhat programming language *do* you know? Because if this line: r301 %r{/wiki/(\w+)_\w+}, ''/$1'' :: doesn''t jump out at you as a regular expression -- certainly when contrasted with the other example lines -- then I suspect you need to just plain read up on RegEx in general... -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org
2010-Jun-28 18:42 UTC
Re: Redirecting old URLs to new permalinked URLs
I program in many languages, and that does not stand out to me. I know C++, Java, CSS, HTML, Lua, and Visual Basic; and that doesn''t stand out to me. I assume that this is from a whole different category of programming/scripting languages; of which I don''t know. Could you please explain to me how it works, and how I can use it in my personal scenario? Thanks In Advance, Joe On 27 June, 19:02, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sun, Jun 27, 2010 at 10:45 AM, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > The environment files? > > > I think thats where it would go. > > So try it and see :-) > > > As for regular expressions, I don''t > > have a clue where it is in the example, Im really not amazingly good > > in RoR > > What programming language *do* you know? Because if this line: > > r301 %r{/wiki/(\w+)_\w+}, ''/$1'' > > :: doesn''t jump out at you as a regular expression -- certainly when > contrasted with the other example lines -- then I suspect you need to > just plain read up on RegEx in general... > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Jun-28 18:53 UTC
Re: Redirecting old URLs to new permalinked URLs
unknown wrote:> I program in many languages, and that does not stand out to me. > I know C++, Java, CSS, HTML, Lua, and Visual Basic; and that doesn''t > stand out to me.CSS and HTML aren''t programming languages. C++ and Java don''t have much regex support. I don''t know Lua or VB, so can''t comment.> I assume that this is from a whole different category > of programming/scripting languages; of which I don''t know.To some extent.> > Could you please explain to me how it works, and how I can use it in > my personal scenario?That would be a bit of a waste of time until you go read the Pickaxe Book''s explanation of regular expressions. You''ve asked a huge number of elementary questions here that could have been answered by reading the docs.> > Thanks In Advance, > > Joe >Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Jun-28 18:57 UTC
Re: Re: Redirecting old URLs to new permalinked URLs
On Mon, Jun 28, 2010 at 11:42 AM, <youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> I program in many languages, and that does not stand out to me. > I know C++, Java, CSS, HTML, Lua, and Visual Basic; and that doesn''t > stand out to me. I assume that this is from a whole different category > of programming/scripting languages; of which I don''t know. > > Could you please explain to me how it works, and how I can use it in > my personal scenario?I think you need to just learn something about regular expressions. /wiki/(\w+)_\w+ "\w A word character: [a-zA-Z_0-9]" The above definition is taken from the API doc for `java.util.regex` :-) which also uses the same ''+'' quantifier and ''( )'' capture group syntax. So there''s nothing out of the ordinary here that a little regex study shouldn''t serve to enlighten... -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org
2010-Jun-28 19:43 UTC
Re: Redirecting old URLs to new permalinked URLs
Hmm. Ok. Ill look into it. So I guess ill want something like this: r301 %r{/tutorials/(\w+)}, ''/ $1'' But instead of using the first unknown word variable (as "/$1" would refer to (as far as I know)); I want it to go to my permalinked URL (http://127.0.0.1:3000/categories/1-css/tutorials/12-test9 ). Please Help (Meanwhile ill look up some regex), Thanks In Advance, Joe On 28 June, 19:57, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Jun 28, 2010 at 11:42 AM, <yout...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > I program in many languages, and that does not stand out to me. > > I know C++, Java, CSS, HTML, Lua, and Visual Basic; and that doesn''t > > stand out to me. I assume that this is from a whole different category > > of programming/scripting languages; of which I don''t know. > > > Could you please explain to me how it works, and how I can use it in > > my personal scenario? > > I think you need to just learn something about regular expressions. > > /wiki/(\w+)_\w+ > > "\w A word character: [a-zA-Z_0-9]" > > The above definition is taken from the API doc for `java.util.regex` :-) > which also uses the same ''+'' quantifier and ''( )'' capture group syntax. > > So there''s nothing out of the ordinary here that a little regex study > shouldn''t serve to enlighten... > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Jun-28 19:52 UTC
Re: Re: Redirecting old URLs to new permalinked URLs
On Mon, Jun 28, 2010 at 12:43 PM, <youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> So I guess ill want something likeWhy guess? That''s what docs are for -- <http://github.com/jtrupiano/rack-rewrite/blob/master/README.rdoc> There''s this thing called ''Der Google'', see... :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org
2010-Jun-29 17:11 UTC
Re: Re: Redirecting old URLs to new permalinked URLs
I''ve already read this, and still don''t understand. Would I need something like this? rewrite %r{/tutorials/(\w+)categories/(\w+)}, ''/categories/ CategoryPermalinkHere/tutorials/TutorialPermalinkHere'' rewrite %r{/tutorials/(\w+)}, ''/categories/CategoryPermalinkHere/ tutorials/TutorialPermalinkHere'' Please Help, I''ve looked everywhere but just can''t figure it out. Thanks In Advance, -Joe Hassan Schroeder wrote:> On Mon, Jun 28, 2010 at 12:43 PM, <youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > So I guess ill want something like > > Why guess? That''s what docs are for -- > > <http://github.com/jtrupiano/rack-rewrite/blob/master/README.rdoc> > > There''s this thing called ''Der Google'', see... :-) > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Jun-29 17:44 UTC
Re: Re: Redirecting old URLs to new permalinked URLs
On Tue, Jun 29, 2010 at 10:11 AM, <youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> I''ve already read this, and still don''t understand.As I said, it''s using regular expressions, and *you* need to figure out how they work. Find a regex tutorial, open up irb and play around. Then, or even before, use the examples in the Rack::Rewrite docs to experiment. It''ll take less time to *just try it* than to compose an email. And at least you''ll be able to say "here''s what I want, here''s what I''ve tried, here are the results". FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''ve tried, but I can''t figure out how to replace $1 with a permalink variable thats in ruby on rails. Im pretty sure regex cannot help me with this, I need to take the permalink value, and use that in the redirect. PLEASE JUST TELL ME AND ILL LEARN, I DONT JUST TAKE THE ANSWER AND BE DONE WITH IT, I LEARN FROM IT. Please Help, Thanks In Advnce, Joe On 29 June, 18:44, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Tue, Jun 29, 2010 at 10:11 AM, <yout...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > I''ve already read this, and still don''t understand. > > As I said, it''s using regular expressions, and *you* need to figure out > how they work. Find a regex tutorial, open up irb and play around. > > Then, or even before, use the examples in the Rack::Rewrite docs to > experiment. It''ll take less time to *just try it* than to compose an email. > And at least you''ll be able to say "here''s what I want, here''s what I''ve > tried, here are the results". > > FWIW, > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Jun-30 01:26 UTC
Re: Re: Redirecting old URLs to new permalinked URLs
On Tue, Jun 29, 2010 at 1:37 PM, Joe <joe-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> I''ve tried, but I can''t figure out how to replace $1 with a permalink > variable thats in ruby on rails. Im pretty sure regex cannot help me > with this, I need to take the permalink value, and use that in the > redirect. > > PLEASE JUST TELL ME AND ILL LEARN, I DONT JUST TAKE THE ANSWER AND BE > DONE WITH IT, I LEARN FROM IT.Top-posting *and* yelling -- not a particularly appealing combination... But one last try. Your original example: http://127.0.0.1:3000/categories/1-css/tutorials/12-test9 http://127.0.0.1:3000/tutorials/12-test9 http://127.0.0.1:3000/categories/1/tutorials/12 http://127.0.0.1:3000/tutorials/12 Sure, you can manually enter rewrite rules for *every one* of your tutorials and categories, and avoid using regular expressions. Be my guest. :-) Or you can start with the simplest example above, and figure out how a simple regex can give you "12" from "/tutorials/12". Write a method to take that value "12" and return "12-test9". Put that in a rewrite rule. Try it with a couple of other values. Works? Good. Start on the next most complex string. Lather, rinse, repeat. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
So, I can''t just pass it my permalink value (which is worked out using to_param)? I have to create a whole method using regex that returns something that is exactly the same? Please Help, I would GREATLY appreciate it if you could just give a reply like "If I had a blog with the same kind of setup, what I could do is write a redirect like this, as you can get the permalink value by doing this." Thanks In Advance, Joe On 30 June, 02:26, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Tue, Jun 29, 2010 at 1:37 PM, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > I''ve tried, but I can''t figure out how to replace $1 with a permalink > > variable thats in ruby on rails. Im pretty sure regex cannot help me > > with this, I need to take the permalink value, and use that in the > > redirect. > > > PLEASE JUST TELL ME AND ILL LEARN, I DONT JUST TAKE THE ANSWER AND BE > > DONE WITH IT, I LEARN FROM IT. > > Top-posting *and* yelling -- not a particularly appealing combination... > > But one last try. Your original example: > > http://127.0.0.1:3000/categories/1-css/tutorials/12-test9http://127.0.0.1:3000/tutorials/12-test9http://127.0.0.1:3000/categories/1/tutorials/12http://127.0.0.1:3000/tutorials/12 > > Sure, you can manually enter rewrite rules for *every one* of your > tutorials and categories, and avoid using regular expressions. Be > my guest. :-) > > Or you can start with the simplest example above, and figure out how > a simple regex can give you "12" from "/tutorials/12". Write a method > to take that value "12" and return "12-test9". Put that in a rewrite rule. > Try it with a couple of other values. Works? Good. Start on the next > most complex string. Lather, rinse, repeat. > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Jun-30 17:28 UTC
Re: Redirecting old URLs to new permalinked URLs
Joe wrote:> So, I can''t just pass it my permalink value (which is worked out using > to_param)? I have to create a whole method using regex that returns > something that is exactly the same? > > Please Help, > > I would GREATLY appreciate it if you could just give a reply like "If > I had a blog with the same kind of setup, what I could do is write a > redirect like this, as you can get the permalink value by doing this."You''re not going to get this list''s populace to write your code for you, no matter how nicely you ask. If you need someone to write your code, please support the Rails ecosystem (which has been helping you for free) and hire a consultant.> > Thanks In Advance, > > Joe > > On 30 June, 02:26, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>-- Posted via http://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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Jun-30 17:55 UTC
Re: Re: Redirecting old URLs to new permalinked URLs
On Wed, Jun 30, 2010 at 10:12 AM, Joe <joe-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> So, I can''t just pass it my permalink value (which is worked out using > to_param)? I have to create a whole method using regex that returns > something that is exactly the same?Why am I starting to feel I''m talking to the wall? :-) You have URLs, .e.g. /tutorials/1 /tutorials/3 /tutorials/12 You need a method to extract the unique ID from each of those and return the permalink value. You don''t *have* to use a regex, it''s just a common approach. Write it any way you want. But that is the first step to solving your problem. Unless you just manually create every rewrite rule, of course.> I would GREATLY appreciate it if you could just give a reply like "If > I had a blog with the same kind of setup, what I could do is write a > redirect like this, as you can get the permalink value by doing this."That *would* be an awesome trick, considering that I don''t have any idea where *your* permalink values are coming from. You could be storing them in the DB, generating them on the fly, scooping them out of Schrödinger''s cat''s litter box -- who knows? Wait -- *you* know, so *you* can write that code. Though as Marnen previously suggested, many of us *are* available for contract work :-) Good luck, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''m using the to_param method in the model file(s). ill try to look up some regex as it could improve my general programming as well as helping with this project. Although I will eventually prrobably figure this out (or at least I hope I will), I will still leave it open that if anyone would like to give me an example or give me a push in the right direction, please do so. Thanks, Joe On 30 June, 18:55, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Wed, Jun 30, 2010 at 10:12 AM, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > So, I can''t just pass it my permalink value (which is worked out using > > to_param)? I have to create a whole method using regex that returns > > something that is exactly the same? > > Why am I starting to feel I''m talking to the wall? :-) > > You have URLs, .e.g. > > /tutorials/1 > /tutorials/3 > /tutorials/12 > > You need a method to extract the unique ID from each of those and > return the permalink value. You don''t *have* to use a regex, it''s just > a common approach. Write it any way you want. But that is the first > step to solving your problem. Unless you just manually create every > rewrite rule, of course. > > > I would GREATLY appreciate it if you could just give a reply like "If > > I had a blog with the same kind of setup, what I could do is write a > > redirect like this, as you can get the permalink value by doing this." > > That *would* be an awesome trick, considering that I don''t have any > idea where *your* permalink values are coming from. You could be > storing them in the DB, generating them on the fly, scooping them out > of Schrödinger''s cat''s litter box -- who knows? > > Wait -- *you* know, so *you* can write that code. > > Though as Marnen previously suggested, many of us *are* available > for contract work :-) > > Good luck, > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.