Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 2 years ago.
0

What I did in the past with Apache:

Put an .htaccess file in the root with:

<IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteCond %{REQUEST_URI} !^public
	RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

And put one in the public folder that is just default

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

If possible change the vhost setting to go to /path/to/laravel/public instead of /path/to/laravel

Last updated 2 years ago.
0

Thanks, by far the best solution, or at least the only one that works well, now i only need to create an exception for a folder inside web root:

www.mywebsite.it/exceptionfolder/... should remains www.mywebsite.it/exceptionfolder/...

Last updated 2 years ago.
0

longilineo said:

Thanks, by far the best solution, or at least the only one that works well, now i only need to create an exception for a folder inside web root:

www.mywebsite.it/exceptionfolder/... should remains www.mywebsite.it/exceptionfolder/...

RewriteCond %{REQUEST_FILENAME} !-d

should take care of that

Last updated 2 years ago.
0

www.mywebsite.it/exceptionfolder/ isn't a route

in my project web root i've

  • app
  • config
  • exceptionfolder
  • controller
  • model
  • public
  • view
  • other laravel default stuff

With that rewrite conditions, if i try to reach

http://www.mywebsite.it/exceptionfolder I get too many redirects error

while reaching http://www.mywebsite.it/exceptionfolder/anythingelse i get NotFoundHttpException

Last updated 2 years ago.
0

move your exceptionfolder into public

Last updated 2 years ago.
0

thanks to all!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.