Laravel .htaccess文件正在将/ public /添加到我到外部网站的所有链接

时间:2019-06-03 14:20:15

标签: laravel .htaccess

我的Laravel .htaccess文件正在将/ public /添加到我到外部网站的所有链接中,如何解决该问题。我在.htaccess中只有这个:

    RewriteEngine开     RewriteRule ^(。*)$ public / $ 1 [L]

请帮助我解决这个问题

谢谢。

1 个答案:

答案 0 :(得分:1)

在您的.htaccess文件上尝试

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

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

<FilesMatch "^\.env">
    Order allow,deny
    Deny from all
 </FilesMatch>

Options All -Indexes

<FilesMatch "\.(jpg|jpeg|png)$">
<IfModule mod_headers.c>
Header set Content-Disposition "attachment"
# for older browsers
Header set Content-Type "application/octet-stream"
</IfModule>
</FilesMatch>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit