My website is built with Laravel but I need the public directory to act like a regular directory. In other words, if someone needs to put up a landing page, I want them to be able to copy files into that folder and access them like they would on a server not running a Laravel application.
For example, normally, someone would be able to copy their HTML, CSS and JS files into a folder and access the index.html file in that folder simply by typing http://www.mydomain.com/folder-name. But when I copy files to my public folder and access like above, I get an error saying "This webpage has a redirect loop". If I go to http://www.mydomain.com/folder-name/index.html it works.
The reason this needs to happen is that there are people that need to create landing pages that don't know Laravel or even PHP. And it's not their job to learn it. So, creating routes, etc. is beyond their capabilities. And using a separate server isn't a good option.
How can I make files in the public folder accessible without having to type in the name of the file?
it should work out of the box, how are you handling your rewrites?
I haven't touched the .htaccess file in the public folder.
Anyone have any ideas? I looked around and found this code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine On
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ / [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . / [L]
But when I replace the contents of public/.htaccess with this and try to access the page with http://www.mydomain.com/folder-name, it gives me a 403 error.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community