.htaccess on root directory to redirect to public folder
As I'm in a shared hosting and I can't create a apache virtual host to point to the public folder I tried to use the solution of creating a .htaccess on the root folder to point to the public but it doesn't work, I'm getting an error: Sorry, the page you are looking for could not be found.:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/ [L]
</IfModule>
How can I solve this?
I also trying to get all the files from the public to the root folder but the css and js files are not loading properly using mix.
Just a question, you want me to put this on the /public_html/.htaccess? If yes, I can't cause I'm not allowed to change the root .htaccess as there are other projects running in other folders and there are rules in that .htaccess. The .htaccess I sent you was located inside /public_html/panel/.htaccess that would point to /public_html/panel/public.
Hmm, well then I think you are going to have a tough time trying to figure that one out. The only suggestion I would have is to place the Laravel site in a subdomain and link it via the root htaccess. That will allow all sites to run. You can even rewrite the url so no one notices.
Ok, I created a subdomain and now I have a folder inside my public_html that is panel I should put your .htaccess code inside the public_html or public_html/panel?
@Snapey hey I need your help. I am trying to host a site on cpanel but outside the public_html directory
soo I created a new dir in the same level as public_html and in the .htaccess I added a rule to redirect to the new dir with the laravel project but I get a 500 error.
I solved setting the document root on cpanel subdomain configuration and it's working properly, the only problem now is that I'm getting error with permissions saying that can't access the log files. I don't want to set 777 permission because I saw that it's not safe.
@snapey how is it dangerous to place the project in a subdomain and redirect to that subdomain with htaccess? I must be missing something if that is the case.