Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abcuse's avatar

500 Server Error I think Htaccess File Is Wrong

I am trying to get a site working on my hosting provider but I get a 500 error and I think it has something to do with the .htaccess file. I am using laravel 9 and PHP 8 but is this a good htaccess file?

<IfModule mod_rewrite.c>

  # Turn Off mod_dir Redirect For Existing Directories
  DirectorySlash Off

  # Rewrite For Public Folder
  RewriteEngine on
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
  RewriteRule ^(.*)$ public/ [L]

</IfModule>
0 likes
2 replies
Snapey's avatar

depends if it is a laravel 500 error or apache?

Have you checked the Laravel logs?

Snapey's avatar

Is the public folder your document root ?

Please or to participate in this conversation.