How to make it work.htaccess in Laravel?
Hello.
I want to put the admin panel of the project in a separate folder. It will be on laravel.
If the site has this structure:
Site.ru/admin(folder)/(Here Laravel files) Then .htaccess in the admin folder does not work.
If this is the case: site.ru/(Here Laravel files) - works.
You can tell me .htaccess which will solve the problem for the first case?
Himself .htaccess is the most default, for removing public from the url.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
That is, the address : site.ru/admin/public/home, I need to shorten to: site.ru/admin/home.
1 answers
If someone does not know how to properly use Google and stackoverflow, then, for them, the answer is simple:
Rename it server.php in index.php, and take .htaccess from the public folder. That is all.
The problem with styles is solved like this:
Update the method in: /Illuminate/Routing/UrlGenerator. php/asset()
public function asset($path, $secure = null)
{
if ($this->isValidUrl($path)) return $path;
$root = $this->getRootUrl($this->getScheme($secure));
return $this->removeIndex($root).'/public/'.trim($path, '/');
}
Source: Laravel 5-Remove public from URL