i want have sub domain particular route
'product_list/home'
previously url used localhost:3000/product_list/home
. want url store.dev:3000/product_list/home
i have modified route this
constraints subdomain: 'store' 'product_list/home' end
in /etc/hosts. have added store.dev follows
127.0.0.1 localhost 127.0.0.1 store.dev
but when visited store.dev:3000
in dev environment, getting homepage localhost:3000
.
but want restrict subdomain route product_list/home
.
and 1 more problem facing
http://store.dev:3000/product_list/home when visit this
i getting
no route matches [get] "/product_list/home"
update:
after changing entry in hosts file .. store.dev
store.local.dev
works able access store.local.dev:3000/product_list/home.
problem able access other pages also, have about
page. store.local.dev:3000/about
, don't want happen. how restrict subdomain 1 particular route
your example , examples in other answers not using subdomains @ all: if @ domain name store.dev
has no subdomain, store.dev
top-level/root domain. example subdomain be: sub.store.dev
if change entry in /etc/hosts file store.dev
store.local.dev
code work.
update
to answer second part of question (restricting route root domain): can achieve wrapping routes should available on root domain in constraints
block empty subdomain:
constraints subdomain: '' '/about' end
Comments
Post a Comment