3

I recently installed Laravel and created a project on my webserver. I had to create a symbolic link for public_html to the public folder inside the Laravel folder. I realized that if I wanted to create another project, how would I do that?

I used to use CodeIgniter and setup was just placing it in a folder and typing the www.url.com/project1 www.url.com/project2 to access the different projects

4
  • You can use laravel modules, each module have its own controller, routes, views. For more info xfer: nwidart.com/laravel-modules/v1/introduction Commented Mar 11, 2017 at 6:16
  • Hi there, thanks for answering. It's a little strange that I would have to use an external package to get this to work? Are there any other ways? Commented Mar 11, 2017 at 6:27
  • Can you configure the server? You can probably use an alias in the config instead of a symlink to the configured document root, or configure rewrites. Commented Mar 11, 2017 at 7:33
  • Hi yes I can configure the server Commented Mar 11, 2017 at 8:32

1 Answer 1

4

Basically each laravel installation comes with a public folder. The public folder contains the index.php file, which is the entry point for all requests entering your application. This directory also houses your assets such as images, JavaScript, and CSS.

If you want to put laravel on sub directory, you will have access to sub directory's public folder. For example, www.url.com/project2/public

But a better solution of this is to create a sub domain and point the directory path to public_html/project2/public so you will have a working laravel on URL like this, www.project2.url.com

This is shared hosting solution and works for all laravel versions.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi! Thanks for the answer. Does this mean I will have to create a subdomain for each project? I'm worried because it seems quite a long process. If I create a sub directory, how would the structure be like? Laravel -> public -> project1 -> public -> index.php ?
Would it be possible to just create a public_html and the create my laravel projects inside it. So the structure will be like public_html -> project1 and public_html-> project2
Yes indeed. Supposing each project folder has laravel installation so each folder's public folder will be your root of application on web.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.