In my Laravel project, the .htaccess
in the application root redirect to /public
. The page loads and I can navigate through the webapp. But https://myproject.com/public/public/mysite
is displayed in the URL.
When I refresh the page, I get a 404 error because myproject.com/public/public/
of course doesn't exist. When I remove the public/public
laravel redirects instantly back to https://myproject.com/public/public/mysite
.
Where does the public/public
come from? I tried some .htaccess configurations, check the .env
file, but it exist no logic reason for me why the app redirects to public/public/
.
Can anyone help me?
.htaccess in root
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
.htaccess in /public
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
.env APP_URL
APP_URL=https://example.com
Anyone an idea? If you need more information, ask me.
Laravel 9.2
PHP 8.2.4