Clicky

rails 2.3 app, the index is example.com/

for seo i want the home page URL to be example.com/something how do i use routes.rb to make this happpen?

asked 09/13/2011 03:30

depassion's gravatar image

depassion ♦♦


8 Answers:
Something like this:

map.root :controller => welcome', :action => 'index'
link
doades's gravatar image

doades

i already have

 map.root :controller => 'info', :action => "index"

that makes example.com/ how to i add the /something?
link
depassion's gravatar image

depassion

So when you first boot or access your site on example.com you want it to redirect to example.com/something?
link
doades's gravatar image

doades

yeah i think so, i just want to add a keyword into the URL for SEO optimization.

example.com/something is the same as example.com/ with this:

map.something "/something", :controller => 'info', :action => "index"

link
depassion's gravatar image

depassion

OK, so (sorry if I'm missing something!) can't you just use those two routes?

map.root :controller => 'info', :action => "index"
map.something "/something", :controller => 'info', :action => "index"

So, http://example.com/  goes to controller 'index' action 'welcome' and if people type http://example.com/something it still goes to controller 'index' action 'welcome'?

Andrew
link
doades's gravatar image

doades

To clarify: is "something" a page that you have created yourself and is it different from the "index" page? Or is it a controller called "something" that you want to create?

What do you want to put on that page and why do you want it to be separate? Since you mention "seo", I'm guess that the word "something" is key to your site... right?

So. Create a controller called "something", add an action/page called "index", then do a
     map.something "/something", :controller => 'something', :action => "index"
similar to what #doades mentioned earlier.
link
JESii's gravatar image

JESii

there is no difference in the /something compared to the home page. Maybe all i need to do is submit the URL to google as www.example.com/something as the home page.

yeah the "something" keyword is just for SEO.

getting keywords in the URL as much as possible helps with SEO
link
depassion's gravatar image

depassion

Fine. Then the suggestion to map "/something" to whatever you want your home page to be is the way to go.
link
JESii's gravatar image

JESii

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×22
×17

Asked: 09/13/2011 03:30

Seen: 334 times

Last updated: 09/14/2011 06:30