Magento has the solution by default but the project should is in the root but if your project is in a sub-folder then you will have a problem recognizing the code new websites.
For Apache the solution is an index.php and .htaccess but if you using Nginx then follow the next steps:
- Create root categories
- Create websites
- Create stores
- Create store views