title: Remove public from URL in Laravel 9 using .htaccess on shared hosting/CPanel hosting
body: <p>I am trying to host a Laravel 9 application on a Cpanel shared host. However, the application keeps returning the below error even when I try to access <code>https://example.com/public</code>. Also below is my .htaccess file at the root; it used to work perfectly with Laravel 8 but is not working anymore. My problem is I want to access my application just using the domain without <code>/public</code> or <code>/public.index.php</code> (e.g., example.com).</p>
  <blockquote>
  <p>Internal server error 500</p>
  </blockquote>
  <p><strong>.htaccess</strong></p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine on
      RewriteCond %{REQUEST_URI} !^public
      RewriteRule ^(.*)$ public/$1 [L]
  &lt;/IfModule&gt;
  </code></pre>