I plan to install Laravel 5 on my shared hosting, and to set my ".htaccess" to serve "laravel/public" directory when trying to get "/".
The problem is I already have some existing sites and other files in my "public_html" directory, which I want them to remain accessible.
My question is how can I handle all the requests to my domain correctly, so the ones that fail to get trapped through Laravel's routes.php and the controllers, will redirect to the real path of the request.
@pmall I prefer to avoid this approach. There are plenty of scripts and sites which weren't created by me, and I have no way to know the dependencies and linking inside them.
There might be absolute paths defined in several places, and massively moving everything can break things .
@bashy I'm exploring different methods for that exactly right now.
Most of them involving changes of plenty of paths, but I just found a tutorial that suggests a smarter way:
According to this, I should override "publicPath" function to return the path to "public_html".
The problem is I'm not familiar with Laravel's routing and I'm not sure what will happen if I do that.
Can you or someone else please look inside the auto-created ".htaccess" in laravel/public, and to approve that everything will work?
I cannot make trial and error since it may affect the other websites.
@bashy as I mentioned, those existing sites weren't created by me. The company had several web apps before I started to work there.
@pmall thanks for the additional method. From what I understand, the defined "public" directory must contain the special ".htaccess" which is automatically created by Laravel during installation, and handles the routing.
I would like to know how it will affect the responses for all the files and subdirectories that will be in that location.
@MeiR_ct no, the only thing this htaccess do is to check if the requested url match a file in the directory. If so it serves the file, if not the request is handled by laravel's index.php.