Hey.

I want to put the admin of the project in a separate folder. She will be on laravel.

If the site has the following structure:

site.ru/admin (folder) / (Here Laravel files) That .htaccess in the admin folder does not work.

If such: site.ru/ (here Laravel files) - works.

Can you suggest .htaccess which will solve the problem for the first case?

Htaccess itself is the most default, for deleting public from url.

<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> 

That is, the address: site.ru/admin/public/home, I need to reduce to: site.ru/admin/home.

    1 answer 1

    If someone does not know how to properly google and stakoferflov, then, for them the answer:

    Rename server.php to index.php, and take the .htaccess from the public folder. It's all.

    The problem with styles is solved like this:

    Update 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

    • Although the link can find the answer to the question, it is better to point out the most important thing here, and give the link as a source. If the page to which the link leads will be changed, the response link may become invalid. - From the queue of checks - Denis Bubnov
    • @DenisBubnov Now styles don't work. Can you tell me how this can be fixed? If the URL: site.ru/admin - {{asset ()}} does not work. If the URL: site.ru/admin/public - {{asset ()}} works. Styles are connected only by the direct specified path with public .. - sasha_t
    • @DenisBubnov, nothing. false alarm, thanks. - sasha_t
    • In any case, I advise you to make an edit in response. The answer should contain information only with the solution of the problem, and not with those who do not know how to use it. Text in English or translate, or remove altogether. - Denis Bubnov