0

How can I remove slug name from URL? I have URL with parent page:

host_url/home/index

but I need this to be as

host_url/index  #without parent slug name
cavpollo
  • 4,071
  • 2
  • 40
  • 64

2 Answers2

0

You can simply change the routes as:

match '/index', :to => 'home#index', via: [:get]
Radix
  • 2,527
  • 1
  • 19
  • 43
  • Atul thanks for your reply but /index is not fix i.e. any other page will also be there..means it is dynamic "host_url/home/page_name". – user3336341 Apr 02 '16 at 13:44
  • As far as I understand your problem, instead of `index`, you can have different (dynamic) name. But it will redirect to the same controller#method. Right? – Radix Apr 02 '16 at 14:56
0

If using resources in routes .

resources :users, path: '/'

get '/index' => 'home#index'
7urkm3n
  • 6,054
  • 4
  • 29
  • 46