Hope you guys are well, I have faced a problem deploying my laravel project on Cpanel. When I am hit my route URL or a root URL then it show me "404 not found"
This is the root url : https://laravel.tamimikbal.com/project1/
I have written this code on my root .htaccess file
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
And this the public/.htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# 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>
2
Answers
The
.htaccess
is not redirecting properly to thepublic
directory. I can access and navigate on your site using "https://laravel.tamimikbal.com/project1/public/".Try this as the contents of the
.htaccess
file in your root:I can better understand if you put how is the routing url should be looks like
anyway you can try this code:
while you don’t have
www.
andhttps
is activated on your domain you can use this code to make redirect fromwww.
tonone www
and fromhttp
tohttps
the rout request and file directory you can use this code
if you want to redirect you system files to
404 page
edit this code and replace your system folder and your404
routing page