1

My website worked fine until I installed SSL certificate. Now my website displays: Forbidden

You don't have permission to access this resource.

Apache/2.4.41 (Ubuntu) Server at www.mysite.com Port 443

My Apache configuration file and virtual host point to mysite-files.com/public directory.

I've checked the directory and subdirectory permission settings of /var/www/html. It's 0755, while for files it's 0644.

My site's SSL checker checks out as valid. whynopadlock.com checks mysite.com as enforcing HTTPS. Yet, I still can't get mysite.com to display again.

I've restarted Apache and my VPS. Still, no joy.

That's why I believe .htaccess file is the culprit.

This is my .htaccess content:

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

    #RewriteEngine On
RewriteEngine On
RewriteCond %{HTTP_HOST} mysite\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ mysite.com/$1 [R,L]

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

Help, please

Wasiu Adisa
  • 19
  • 1
  • 1
  • 4

2 Answers2

0
<IfModule mod_rewrite.c>

RewriteEngine On RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L]

Try using this code in your .htaccess file, this works for laravel 9

Green looker
  • 11
  • 1
  • 4
0

I finally found a solution on this thread. Editing Apache2 configuration file and inclusion in .htaccess file

Worked like a charm.

Wasiu Adisa
  • 19
  • 1
  • 1
  • 4
  • 1
    you marked other question as correct and comment "doesn't work"... – francisco Aug 28 '22 at 11:20
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 31 '22 at 14:51