?
Solved

change default URL rails 2

Posted on 2011-09-13
8
Medium Priority
?
341 Views
Last Modified: 2012-08-14
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?
0
Comment
Question by:depassion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 10

Accepted Solution

by:
Andrew Doades earned 1000 total points
ID: 36531927
Something like this:

map.root :controller => welcome', :action => 'index'
0
 

Author Comment

by:depassion
ID: 36531935
i already have

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

that makes example.com/ how to i add the /something?
0
 
LVL 10

Expert Comment

by:Andrew Doades
ID: 36531960
So when you first boot or access your site on example.com you want it to redirect to example.com/something?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:depassion
ID: 36531986
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"

0
 
LVL 10

Expert Comment

by:Andrew Doades
ID: 36532033
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
0
 
LVL 12

Assisted Solution

by:JESii
JESii earned 1000 total points
ID: 36533477
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.
0
 

Author Comment

by:depassion
ID: 36535512
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
0
 
LVL 12

Expert Comment

by:JESii
ID: 36537835
Fine. Then the suggestion to map "/something" to whatever you want your home page to be is the way to go.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below: http://www.rubytips.org/2008/05/13/accessing-windows-api-fro…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month8 days, 4 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question