Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fico7489's avatar

htaccess for root folder

I can't find htaccess for root folder. My page is now accessible trough www.example.com/public when I put:


RewriteEngine On RewriteRule ^(.*)$ public/$1 [L]


in root htaccess, css, js files are correcty requested but when I request website error is shown :

NotFoundHttpException in RouteCollection.php line 145:

I want my page accesible trought: www.example.com Puting public folder content in www server folder is not solution because I wan't flexibility to have more laravel websites on one domain.

0 likes
5 replies
christopher's avatar

Your error says that there is an issue with your routes.php Maybe you did not specify the url which you access ?

Can you post your routes.php ?

The .htaccess should be fine

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

Try setting the RewriteBase to / in you public .htaccess file. But its a bad idea to use this approach, it would be much easier to just let the domain link to the public folder (via setting or via symlink). Multiple installations per domain could be solved through the use of subdomains.

bashy's avatar

With multiple sites as sub directories, I would use the symlink approach.

var/
    - www/ // root of example.com/
        - laravel1/ // symlink to ../sites/laravel1/public
        - laravel2/ // symlink to ../sites/laravel2/public
        - laravel3/ // symlink to ../sites/laravel3/public
    - sites/
        - laravel1/
            - public/
        - laravel2/
            - public/
        [...]
fico7489's avatar

First and second solution not working. @bashy can you plesase give me more info how to do this?

bashy's avatar

I need more info on where your sites are located, then I can give you commands to run to create those symlinks. If that's what you need?

Also you sure you're using Apache?

Please or to participate in this conversation.