Error 404 after configuring SSL in Apache

Asked

Viewed 1,179 times

2

I have a VPS running Centos 7 and an Apache server, and I have a website running perfectly within the /var/www/html/meusite folder. But this using HTTP. I then decided to generate an SSL to run the site on HTTPS. From then on, the site runs using HTTPS, but only the home page. The rest of the pages don’t load, give me a 404 error (Example: "The requested URL /admin was not found on this server").

So is my . htaccess:

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

RewriteEngine On

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

My Virtualhost at httpd.conf:

<VirtualHost *:80>

ServerName www.meusite.com.br

ServerAdmin [email protected]
DocumentRoot /var/www/html/meusite/public

<Directory /var/www/html/meusite/public>
    AllowOverride All
</Directory>

I’m racking my brain to find the mistake but I have no idea what it might be. Anyone have any ideas? Thanks!

1 answer

0

I was able to answer my problem, so I’ll leave the solution here, just in case someone has the same problem. I am using the Laravel framework, and it seems that in case when you use this framework, it is good to add the following block of code in the ssl.conf file:

<Directory /var/www/html/seuprojeto/public>
   AllowOverride All
</Directory>

I did it and it worked right. The whole site runs, no error 404.

  • Please mark this answer as correct

Browser other questions tagged

You are not signed in. Login or sign up in order to post.