Reputation: 10952
Using Rails 3 routing, I'd like all visitors to the home page
http//mysite.com/
to see the URL
http//mysite.com/mykeyword
in their browser URL.
In other words, all visits to the home page get redirected to
http//mysite.com/mykeyword
This is approximately the opposite of the typical route
root :to => "home#index"
or
match '/' => 'home#index'
where any controller name gets stripped off from the home page URL.
Instead I want every visit to the site home page to include "mykeyword" in the URL.
How?
Upvotes: 2
Views: 1971
Reputation: 6515
Justin is correct, but I believe you also want a redirect. To do that:
match "/" => redirect("/mykeyword")
Upvotes: 3
Reputation: 13548
Try this:
match '/mykeyword' => "home#index"
You want visitors to still be on the homepage, but the url to say "www.mysite.com/mykeyword" right? If so, that should work.
Upvotes: 1