HTTPS : .htaccess (public /)를 사용하는 Laravel

Sep 04 2019

내 laravel 프로젝트로 전달되는 SSL 인증 웹 사이트에서 htaccess사용 proxypass하고 있기 때문에 godaddy를 사용하지 않고 내 라 라벨 프로젝트에 https를 포함하려고합니다 .

내 laravel 프로젝트를 https로 만들기 만하면됩니다.

그래서이 코드를 내 .htaccess에 추가하려고했습니다. public/

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://myproject.com/$1 [R=301,L]

여기 내 public/.htaccess

<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]

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

업데이트 됨

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

RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# 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]

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

내 httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/e-wallet-frontend/public"
ServerName localhost

<Directory "/opt/lampp/htdocs/e-wallet-frontend/public">
   Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

ErrorLog "logs/frontendewallet.com-error_log"
CustomLog "logs/frontendewallet.com-access_log" common
</VirtualHost>

HTTPS표시되지만 브라우저가 말한다 Object not Found가 뭔가 잘못 내 htaccess로 함께?

답변

2 AhmadKarimi Sep 05 2019 at 19:50
RewriteRule ^(.*)$ https://www.myproject.com/$1 [R=301,L]

이것은 여러 Laravel 프로젝트에있는 코드입니다.