I have recently installed Laravel into my public_html folder. I want it so when I log into www.malhub.com it gets the contents of the public folder (public_html/public).
After trial and error, I was able to get it working somewhat. Now I have a 404 error, which is caused because the site (www.malhub.com) resolves to :
http://malhub.com/public/public_html
But my .htaccess code states:
RewriteRule ^(.*)$ public_html/public/$1 [L]
In other words, it looks for a public_html folder within the public folder (should just be the public folder)
I added some folders (test) just to make sense of how this works and am befuddled. It is going into the public folder and looking for another folder.
When I just try writing:
RewriteRule ^(.*)$ public/$1 [L]
or “public_html” or any combination of /../../ I keep getting 500 errors (that don’t show the url).
How does this line of code work, and what is the optimum way?
2
Answers
By default the website will be load from public folder.
If you want to remove public from your url,copy
.htaccess
file frompublic
folder to root and replace the code with the following..If you don’t want to remove all files and folder from the
public
folder, then just copy.htaccess
to your root directory and renameserver.php
toindex.php
and last one step is if all resource files in/public
directory couldn’t find and request URLs didn’t work for usingasset()
helper. Then, you need to addpublic
to yourhelpers.php
file.To
You will fine the
helpers.php
invendor/laravel/framework/src/Illuminate/Foundation/helpers.php
.