skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

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

    Worked like a charm.


  2. <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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search