I want to create a web site builder. What I’m thinking is to have a one server as the main web server
my concept is as follows
1 – user enters url (http://www.userdomain.com)
2- it masks and redirect to one of my custom domain (http://www.myapp.userdomain.com)
3 – from the custom domain (myapp.userdomain) my application will identify the web site
3 – according to the website, it will render pages
my concerns are,
1 – is this the proper way of doing something like this (online web site builder)
2- since I’m masking the url i will not be able to do something like
‘http://www.myapp.userdomain.com/products’
and if the user refresh the page it goes to home page (http://www.myapp.userdomain.com). how to avoid that
3- I’m thinking of using Rails, liquid for this. Will that be a good option
thanks in advance
cheers
sameera
Masking domains with redirects is going to get messy plus all those redirects may not play nice for SEO. Rails doesn’t care if you host everything under a common domain name. It’s just as easy to detect the requested domain name as it is the requested subdomain.
I suggest pointing all of your end-user domains directly to the IP of your main server so that redirects are not required. Use the the :domain and :subdomain conditions in the Rails router or parse them in your application controller to determine which site to actually render based on the hostname the user requested. This gives you added flexibility later as you could tell Apache or Nginx which domains to listen for and setup different instances of your application as to support rolling upgrades and things like that.
Sounds like this was @wukerplank’s approach and I agree. Custom router to look at the domain name of the current request keeps the rest of your application simple.